Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Unified Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart

Issue 1347423003: dart2js: Make sure that super classes have their inheritance chain set up correctly. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/inheritance_chain_lib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
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 aa2de7746925cce5da6ec2e5a57e79d36ecc5cfe..c01ab903188d72576753ab6930a6f8381b7f04a9 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
@@ -777,14 +777,27 @@ class FragmentEmitter {
List<js.Expression> inheritCalls = <js.Expression>[];
List<js.Expression> mixinCalls = <js.Expression>[];
+ Set<Class> emittedClasses = new Set<Class>();
+
+ void emitInheritanceForClass(cls) {
+ if (cls == null || emittedClasses.contains(cls)) return;
+
+ Class superclass = cls.superclass;
+ emitInheritanceForClass(superclass);
+
+ js.Expression superclassReference = (superclass == null)
+ ? new js.LiteralNull()
+ : classReference(superclass);
+
+ inheritCalls.add(js.js('inherit(#, #)',
+ [classReference(cls), superclassReference]));
+
+ emittedClasses.add(cls);
+ }
+
for (Library library in fragment.libraries) {
for (Class cls in library.classes) {
- js.Expression superclassReference = (cls.superclass == null)
- ? new js.LiteralNull()
- : classReference(cls.superclass);
-
- inheritCalls.add(js.js('inherit(#, #)',
- [classReference(cls), superclassReference]));
+ emitInheritanceForClass(cls);
if (cls.isMixinApplication) {
MixinApplication mixin = cls;
« no previous file with comments | « no previous file | tests/language/inheritance_chain_lib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698