[dart2js] Cleaning up no-legacy-mode failures.
Partial revert of: https://dart-review.googlesource.com/c/sdk/+/158160
Change-Id: I81bf4b07a45d3bd83bbbd04cf4fb78d9cc94b68f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196020
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index c99d393..786b808 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -92,10 +92,9 @@
// proto-property of the classes 'prototype' field.
// Older IEs use `Object.create` and copy over the properties.
function inherit(cls, sup) {
- // Note that RTI needs cls.name, but we don't need to set it anymore.
- if (#legacyJavaScript) {
- cls.prototype.constructor = cls;
- }
+ // cls.prototype.constructor carries the cached RTI. We could avoid this by
+ // using ES6 classes, but the side effects of this need to be tested.
+ cls.prototype.constructor = cls;
cls.prototype[#operatorIsPrefix + cls.name] = cls;
// The superclass is only null for the Dart Object.
@@ -813,8 +812,7 @@
'call0selector': js.quoteName(call0Name),
'call1selector': js.quoteName(call1Name),
- 'call2selector': js.quoteName(call2Name),
- 'legacyJavaScript': _options.legacyJavaScript
+ 'call2selector': js.quoteName(call2Name)
});
if (program.hasSoftDeferredClasses) {
mainCode = js.Block([
@@ -1202,7 +1200,6 @@
properties
.add(js.Property(js.string("constructor"), classReference(cls)));
}
-
properties.add(js.Property(_namer.operatorIs(cls.element), js.number(1)));
}