Index: pkg/compiler/lib/src/js_backend/field_naming_mixin.dart |
diff --git a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart |
index a213223f8bea5168bec2863a0367ab439e946e66..3405339113f3890066fbbaf48308796da24d1a94 100644 |
--- a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart |
+++ b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart |
@@ -13,7 +13,7 @@ abstract class _MinifiedFieldNamer implements Namer { |
// The inheritance scope based naming might not yield a name. For instance, |
// this could be because the field belongs to a mixin. In such a case this |
// will return `null` and a normal field name has to be used. |
- jsAst.Name _minifiedInstanceFieldPropertyName(FieldElement element) { |
+ jsAst.Name _minifiedInstanceFieldPropertyName(FieldEntity element) { |
if (_nativeData.hasFixedBackendName(element)) { |
return new StringBackedName(_nativeData.getFixedBackendName(element)); |
} |
@@ -21,8 +21,10 @@ abstract class _MinifiedFieldNamer implements Namer { |
_FieldNamingScope names; |
if (element is BoxFieldElement) { |
names = new _FieldNamingScope.forBox(element.box, fieldRegistry); |
+ } else if (element is JBoxedField) { |
+ names = new _FieldNamingScope.forBox(element.box, fieldRegistry); |
} else { |
- ClassElement cls = element.enclosingClass; |
+ ClassEntity cls = element.enclosingClass; |
names = new _FieldNamingScope.forClass(cls, _closedWorld, fieldRegistry); |
} |
@@ -116,19 +118,20 @@ class _FieldNamingScope { |
} |
factory _FieldNamingScope.forClass( |
- ClassElement cls, ClosedWorld world, _FieldNamingRegistry registry) { |
+ ClassEntity cls, ClosedWorld world, _FieldNamingRegistry registry) { |
_FieldNamingScope result = registry.scopes[cls]; |
if (result != null) return result; |
if (world.isUsedAsMixin(cls)) { |
result = new _MixinFieldNamingScope.mixin(cls, registry); |
} else { |
- if (cls.superclass == null) { |
+ var superclass = world.elementEnvironment.getSuperClass(cls); |
+ if (superclass == null) { |
result = new _FieldNamingScope.rootScope(cls, registry); |
} else { |
_FieldNamingScope superScope = |
- new _FieldNamingScope.forClass(cls.superclass, world, registry); |
- if (cls.isMixinApplication) { |
+ new _FieldNamingScope.forClass(superclass, world, registry); |
+ if (world.elementEnvironment.isMixinApplication(cls)) { |
result = |
new _MixinFieldNamingScope.mixedIn(cls, superScope, registry); |
} else { |
@@ -137,7 +140,10 @@ class _FieldNamingScope { |
} |
} |
- cls.forEachInstanceField((cls, field) => result.add(field)); |
+ world.elementEnvironment.forEachClassMember(cls, |
+ (ClassEntity declarer, MemberEntity member) { |
+ if (member.isField && member.isInstanceMember) result.add(member); |
+ }); |
registry.scopes[cls] = result; |
return result; |
@@ -166,13 +172,13 @@ class _FieldNamingScope { |
jsAst.Name _nextName() => registry.getName(_localFieldNameCounter++); |
- jsAst.Name operator [](Element field) { |
+ jsAst.Name operator [](Entity field) { |
jsAst.Name name = names[field]; |
if (name == null && superScope != null) return superScope[field]; |
return name; |
} |
- void add(Element field) { |
+ void add(Entity field) { |
if (names.containsKey(field)) return; |
jsAst.Name value = _nextName(); |
@@ -180,7 +186,7 @@ class _FieldNamingScope { |
names[field] = value; |
} |
- bool containsField(Element field) => names.containsKey(field); |
+ bool containsField(Entity field) => names.containsKey(field); |
} |
/** |
@@ -227,7 +233,7 @@ class _BoxFieldNamingScope extends _FieldNamingScope { |
@override |
bool containsField(_) => true; |
- jsAst.Name operator [](Element field) { |
+ jsAst.Name operator [](Entity field) { |
if (!names.containsKey(field)) add(field); |
return names[field]; |
} |