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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/ClassScope.java

Issue 11776037: Initial support for mixins in dartc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Forgot MixinScope.java Created 7 years, 11 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: compiler/java/com/google/dart/compiler/resolver/ClassScope.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/ClassScope.java b/compiler/java/com/google/dart/compiler/resolver/ClassScope.java
index a1b9a5bb08e86b5bbb011b4906c4a87586178975..e8e835cb3886c87b6343ba4d88f2f1a83cb308ce 100644
--- a/compiler/java/com/google/dart/compiler/resolver/ClassScope.java
+++ b/compiler/java/com/google/dart/compiler/resolver/ClassScope.java
@@ -55,15 +55,28 @@ class ClassScope extends Scope {
}
}
}
-
+
List<InterfaceType> interfaces = classElement.getInterfaces();
for (int i = 0, size = interfaces.size(); i < size; i++) {
- InterfaceType supertype = interfaces.get(i);
- Element enclosing = supertype.getElement().getEnclosingElement();
- ClassElement superclassElement = supertype.getElement();
- if (!examinedTypes.contains(superclassElement)) {
- ClassScope scope = new ClassScope(superclassElement,
+ InterfaceType intf = interfaces.get(i);
+ ClassElement intfElement = intf.getElement();
+ if (!examinedTypes.contains(intfElement)) {
+ Element enclosing = intf.getElement().getEnclosingElement();
+ MixinScope scope = new MixinScope(intfElement,
Brian Wilkerson 2013/01/09 16:17:41 I think this wanted to still be ClassScope and you
new Scope("library", (LibraryElement) enclosing));
+ element = scope.findElement(inLibrary, name);
+ if (element != null) {
+ return element;
+ }
+ }
+ }
+
+ List<InterfaceType> mixins = classElement.getMixins();
+ for (int i = 0, size = mixins.size(); i < size; i++) {
+ InterfaceType mixin = mixins.get(i);
+ ClassElement mixinElement = mixin.getElement();
+ if (!examinedTypes.contains(mixinElement)) {
+ ClassScope scope = new ClassScope(mixinElement, null);
element = scope.findElement(inLibrary, name, examinedTypes);
if (element != null) {
return element;

Powered by Google App Engine
This is Rietveld 408576698