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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 799553002: dart2js: fix mixin support in deferred libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tests Created 6 years 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/deferred_mixin_lib1.dart » ('j') | tests/language/deferred_mixin_lib1.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
index 57951b87a398cd207898d3ec1855f5e97dc695d9..c52b465d4667a2c21d2f2f3b475a72feebd5b035 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart
@@ -529,19 +529,6 @@ class OldEmitter implements Emitter {
})(functionSignature);
}
- if (#needsMixinSupport)
- if (supr && supr.indexOf("+") > 0) {
- s = supr.split("+");
- supr = s[0];
- var mixin = collectedClasses[s[1]];
- if (mixin instanceof Array) mixin = mixin[1];
- for (var d in mixin) {
- if (hasOwnProperty.call(mixin, d) &&
- !hasOwnProperty.call(desc, d))
- desc[d] = mixin[d];
- }
- }
-
if (typeof dart_precompiled != "function") {
combinedConstructorFunction += defineClass(cls, fields);
constructorsList.push(cls);
@@ -584,7 +571,6 @@ class OldEmitter implements Emitter {
'debugFastObjects': DEBUG_FAST_OBJECTS,
'hasRetainedMetadata': backend.hasRetainedMetadata,
'metadata': metadataAccess,
- 'needsMixinSupport': needsMixinSupport,
'isTreeShakingDisabled': backend.isTreeShakingDisabled,
'finishClassFunction': buildFinishClass(),
'trivialNsmHandlers': nsmEmitter.buildTrivialNsmHandlers()});
@@ -614,6 +600,28 @@ class OldEmitter implements Emitter {
finishedClasses[cls] = true;
var superclass = pendingClasses[cls];
+
+ if (#needsMixinSupport) {
+ if (superclass && superclass.indexOf("+") > 0) {
+ var s = superclass.split("+");
+ superclass = s[0];
+ var mixinClass = s[1];
+ finishClass(mixinClass);
+ var mixin = allClasses[mixinClass];
+ // TODO(floitsch): this test shouldn't be necessary. Without it
+ // we have a crash in pkg/analysis_server/tool/spec/check_all_test.
+ if (mixin) {
+ var mixinPrototype = mixin.prototype;
+ var clsPrototype = allClasses[cls].prototype;
+ for (var d in mixinPrototype) {
+ if (hasOwnProperty.call(mixinPrototype, d) &&
+ !hasOwnProperty.call(clsPrototype, d))
+ clsPrototype[d] = mixinPrototype[d];
+ }
+ }
+ }
+ }
+
// The superclass is only false (empty string) for the Dart Object
// class. The minifier together with noSuchMethod can put methods on
// the Object.prototype object, and they show through here, so we check
@@ -679,6 +687,7 @@ class OldEmitter implements Emitter {
}
}
}''', {'finishedClassesAccess': finishedClassesAccess,
+ 'needsMixinSupport': needsMixinSupport,
'hasNativeClasses': nativeClasses.isNotEmpty,
'interceptorsByTagAccess': interceptorsByTagAccess,
'leafTagsAccess': leafTagsAccess,
« no previous file with comments | « no previous file | tests/language/deferred_mixin_lib1.dart » ('j') | tests/language/deferred_mixin_lib1.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698