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

Unified Diff: lib/compiler/implementation/universe.dart

Issue 10834243: Reduce usage of .enclosingElement to get enclosing class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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: lib/compiler/implementation/universe.dart
diff --git a/lib/compiler/implementation/universe.dart b/lib/compiler/implementation/universe.dart
index ebf742aa5c177e161b6adb3a7909fba739479279..c8896aee5197bad3987a35954ce112477ec137df 100644
--- a/lib/compiler/implementation/universe.dart
+++ b/lib/compiler/implementation/universe.dart
@@ -304,14 +304,14 @@ class TypedSelector extends Selector {
*/
bool hasElementIn(ClassElement cls, Element element) {
Element resolved = cls.lookupMember(element.name);
- if (resolved === element) return true;
+ if (resolved === element) return true;
if (resolved === null) return false;
if (resolved.kind === ElementKind.ABSTRACT_FIELD) {
AbstractFieldElement field = resolved;
if (element === field.getter || element === field.setter) {
return true;
} else {
- ClassElement otherCls = field.enclosingElement;
+ ClassElement otherCls = field.getEnclosingClass();
// We have not found a match, but another class higher in the
// hierarchy may define the getter or the setter.
return hasElementIn(otherCls.superclass, element);
@@ -321,14 +321,14 @@ class TypedSelector extends Selector {
}
bool applies(Element element, Compiler compiler) {
- if (!element.enclosingElement.isClass()) return false;
+ if (!element.isMember()) return false;
// A closure can be called through any typed selector:
// class A {
// get foo() => () => 42;
// bar() => foo(); // The call to 'foo' is a typed selector.
// }
- ClassElement other = element.enclosingElement;
+ ClassElement other = element.getEnclosingClass();
if (other.superclass === compiler.closureClass) {
return super.applies(element, compiler);
}

Powered by Google App Engine
This is Rietveld 408576698