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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 13685022: Make mixins work on native classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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
Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index b2ad0686849ba4ab0dd2c63c6b335a1026f6048b..97f703b1e362237e3ad7798259d35622ec485380 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -1171,21 +1171,6 @@ class CodeEmitterTask extends CompilerTask {
}
}
- // TODO(kasperl): We should make sure to only emit one version of
- // overridden methods. Right now, we rely on the ordering so the
- // methods pulled in from mixins are replaced with the members
- // from the class definition.
-
- // If the class is a native class, we have to add the instance
- // members defined in the non-native mixin applications used by
- // the class.
- visitNativeMixins(classElement, (MixinApplicationElement mixin) {
- mixin.forEachMember(
- visitMember,
- includeBackendMembers: true,
- includeSuperMembers: false);
- });
-
classElement.implementation.forEachMember(
visitMember,
includeBackendMembers: true,
@@ -1296,22 +1281,6 @@ class CodeEmitterTask extends CompilerTask {
}
}
- void visitNativeMixins(ClassElement classElement,
- void visit(MixinApplicationElement mixinApplication)) {
- if (!classElement.isNative()) return;
- // Use recursion to make sure to visit the superclasses before the
- // subclasses. Once we start keeping track of the emitted fields
- // and members, we're going to want to visit these in the other
- // order so we get the most specialized definition first.
- void recurse(ClassElement cls) {
- if (cls == null || !cls.isMixinApplication) return;
- recurse(cls.superclass);
- assert(!cls.isNative());
- visit(cls);
- }
- recurse(classElement.superclass);
- }
-
/**
* Documentation wanted -- johnniwinther
*
@@ -1389,15 +1358,6 @@ class CodeEmitterTask extends CompilerTask {
// fields pulled in from mixins are replaced with the fields from
// the class definition.
- // If the class is a native class, we have to add the fields
- // defined in the non-native mixin applications used by the class.
- visitNativeMixins(classElement, (MixinApplicationElement mixin) {
- mixin.forEachInstanceField(
- visitField,
- includeBackendMembers: true,
- includeSuperMembers: false);
- });
-
// If a class is not instantiated then we add the field just so we can
// generate the field getter/setter dynamically. Since this is only
// allowed on fields that are in [classElement] we don't need to visit
@@ -1405,7 +1365,7 @@ class CodeEmitterTask extends CompilerTask {
classElement.implementation.forEachInstanceField(
visitField,
includeBackendMembers: true,
- includeSuperMembers: isInstantiated && !classElement.isNative());
+ includeSuperMembers: isInstantiated);
}
void generateGetter(Element member, String fieldName, String accessorName,
@@ -1590,12 +1550,7 @@ class CodeEmitterTask extends CompilerTask {
needsDefineClass = true;
String className = namer.getName(classElement);
- // Find the first non-native superclass.
ClassElement superclass = classElement.superclass;
- while (superclass != null && superclass.isNative()) {
- superclass = superclass.superclass;
- }
-
String superName = "";
if (superclass != null) {
superName = namer.getName(superclass);
@@ -1725,17 +1680,6 @@ class CodeEmitterTask extends CompilerTask {
generateInterfacesIsTests(interfaceType.element, emitIsTest,
emitSubstitution, generated);
}
-
- // For native classes, we also have to run through their mixin
- // applications and make sure we deal with 'is' tests correctly
- // for those.
- visitNativeMixins(cls, (MixinApplicationElement mixin) {
- for (DartType interfaceType in mixin.interfaces) {
- ClassElement interfaceElement = interfaceType.element;
- generateInterfacesIsTests(interfaceType.element, emitIsTest,
- emitSubstitution, generated);
- }
- });
}
/**

Powered by Google App Engine
This is Rietveld 408576698