@@ -83,7 +83,9 @@ function setFunctionNamesIfNecessary(holders) {
83
83
// Older IEs use `Object.create` and copy over the properties.
84
84
function inherit(cls, sup) {
85
85
// 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
+ }
87
89
cls.prototype[#operatorIsPrefix + cls.name] = cls;
88
90
89
91
// The superclass is only null for the Dart Object.
@@ -730,6 +732,7 @@ class FragmentEmitter {
730
732
'call0selector' : js.quoteName (call0Name),
731
733
'call1selector' : js.quoteName (call1Name),
732
734
'call2selector' : js.quoteName (call2Name),
735
+ 'legacyJavaScript' : _options.legacyJavaScript
733
736
});
734
737
if (program.hasSoftDeferredClasses) {
735
738
mainCode = js.Block ([
@@ -1129,9 +1132,12 @@ class FragmentEmitter {
1129
1132
List <js.Property > properties = [];
1130
1133
1131
1134
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
+
1135
1141
properties.add (js.Property (_namer.operatorIs (cls.element), js.number (1 )));
1136
1142
}
1137
1143
0 commit comments