Skip to content

Commit 2337219

Browse files
joshualittcommit-bot@chromium.org
authored andcommitted
[dart2js] Remove unnecessary line.
Change-Id: I7b1f16d156d9cc10fde378aa4b8d69ab66ca701a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158160 Commit-Queue: Joshua Litt <[email protected]> Reviewed-by: Stephen Adams <[email protected]>
1 parent f20b0dd commit 2337219

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ function setFunctionNamesIfNecessary(holders) {
8383
// Older IEs use `Object.create` and copy over the properties.
8484
function inherit(cls, sup) {
8585
// Note that RTI needs cls.name, but we don't need to set it anymore.
86-
cls.prototype.constructor = cls;
86+
if (#legacyJavaScript) {
87+
cls.prototype.constructor = cls;
88+
}
8789
cls.prototype[#operatorIsPrefix + cls.name] = cls;
8890
8991
// The superclass is only null for the Dart Object.
@@ -730,6 +732,7 @@ class FragmentEmitter {
730732
'call0selector': js.quoteName(call0Name),
731733
'call1selector': js.quoteName(call1Name),
732734
'call2selector': js.quoteName(call2Name),
735+
'legacyJavaScript': _options.legacyJavaScript
733736
});
734737
if (program.hasSoftDeferredClasses) {
735738
mainCode = js.Block([
@@ -1129,9 +1132,12 @@ class FragmentEmitter {
11291132
List<js.Property> properties = [];
11301133

11311134
if (cls.superclass == null) {
1132-
// TODO(sra): What is this doing? Document or remove.
1133-
properties
1134-
.add(js.Property(js.string("constructor"), classReference(cls)));
1135+
// ie11 might require us to set 'constructor' but we aren't 100% sure.
1136+
if (_options.legacyJavaScript) {
1137+
properties
1138+
.add(js.Property(js.string("constructor"), classReference(cls)));
1139+
}
1140+
11351141
properties.add(js.Property(_namer.operatorIs(cls.element), js.number(1)));
11361142
}
11371143

0 commit comments

Comments
 (0)