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

Unified Diff: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.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/type/TypeAnalyzer.java
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
index 7f84a5c15e7c5de42d09a957ca2c6e50ef42f4fd..d70e077e630a5090859cab6c14072a69f673ec08 100644
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java
@@ -3210,10 +3210,33 @@ public class TypeAnalyzer implements DartCompilationPhase {
}
// Visit superclasses (without interfaces) and mark methods as implemented.
- InterfaceType supertype = currentClass.getElement().getSupertype();
- while (supertype != null) {
- ClassElement superclass = supertype.getElement();
- for (Element member : superclass.getMembers()) {
+ {
+ List<InterfaceType> superTypes = Lists.newArrayList();
+ superTypes.add(currentClass.getElement().getSupertype());
+ for (InterfaceType supertype : superTypes) {
+ while (supertype != null) {
+ ClassElement superclass = supertype.getElement();
+ for (Element member : superclass.getMembers()) {
+ String name = member.getName();
+ if (!Elements.isAbstractElement(member)) {
+ superMembers.removeAll(name);
+ }
+ if (member instanceof FieldElement) {
+ FieldElement field = (FieldElement) member;
+ if (field.getSetter() != null) {
+ superMembers.removeAll("setter " + name);
+ }
+ }
+ }
+ supertype = supertype.getElement().getSupertype();
+ }
+ }
+ }
+
+ // visit mixins
+ for (InterfaceType mixType : currentClass.getElement().getMixins()) {
+ ClassElement mixElement = mixType.getElement();
+ for (Element member : mixElement.getMembers()) {
String name = member.getName();
if (!Elements.isAbstractElement(member)) {
superMembers.removeAll(name);
@@ -3225,7 +3248,6 @@ public class TypeAnalyzer implements DartCompilationPhase {
}
}
}
- supertype = supertype.getElement().getSupertype();
}
// Remove artificial "setter " members.

Powered by Google App Engine
This is Rietveld 408576698