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

Unified Diff: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.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: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java
diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java
index 0f0dd0a93456a970d3a8659e88aa12150626d401..a10c1d4c599f5bb7e4bbe40728ab16b0ed3a2edd 100644
--- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java
+++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/internal/model/CompilationUnitImpl.java
@@ -18,6 +18,7 @@ import com.google.dart.compiler.DartCompilationError;
import com.google.dart.compiler.ast.ASTVisitor;
import com.google.dart.compiler.ast.DartBlock;
import com.google.dart.compiler.ast.DartClass;
+import com.google.dart.compiler.ast.DartClassTypeAlias;
import com.google.dart.compiler.ast.DartComment;
import com.google.dart.compiler.ast.DartDeclaration;
import com.google.dart.compiler.ast.DartExpression;
@@ -221,6 +222,31 @@ public class CompilationUnitImpl extends SourceFileElementImpl<CompilationUnit>
}
/**
+ * Parse a top-level type and add a Type as a child of the compilation unit to represent it.
+ */
+ @Override
+ public Void visitClassTypeAlias(DartClassTypeAlias node) {
+ String className = node.getClassName();
+ DartClassTypeAliasImpl typeImpl = new DartClassTypeAliasImpl(compilationUnit, className);
+ DartTypeInfo typeInfo = new DartTypeInfo();
+ List<DartElementImpl> children = Lists.newArrayList();
+ addNewElement(typeImpl, typeInfo);
+
+ // add DartTypeParameter elements
+ addTypeParameters(node.getTypeParameters(), typeImpl, children);
+
+ typeInfo.setSuperclassName(extractTypeName(node.getSuperclass(), false));
+ typeInfo.setInterfaceNames(extractTypeNames(node.getInterfaces(), false));
+ typeInfo.setSourceRangeStart(node.getSourceInfo().getOffset());
+ typeInfo.setSourceRangeEnd(node.getSourceInfo().getEnd());
+ captureDartDoc(node, typeInfo);
+ typeInfo.setNameRange(new SourceRangeImpl(node.getName()));
+ typeInfo.setChildren(DartElementImpl.toArray(children));
+ topLevelElements.add(typeImpl);
+ return null;
+ }
+
+ /**
* Parse a top-level variable and add a DartVariableImpl as a child of the compilation unit to
* represent it.
*/
@@ -1221,6 +1247,13 @@ public class CompilationUnitImpl extends SourceFileElementImpl<CompilationUnit>
}
@Override
+ public com.google.dart.tools.core.model.DartClassTypeAlias[] getClassTypeAliases()
+ throws DartModelException {
+ List<com.google.dart.tools.core.model.DartClassTypeAlias> typeList = getChildrenOfType(com.google.dart.tools.core.model.DartClassTypeAlias.class);
+ return typeList.toArray(new com.google.dart.tools.core.model.DartClassTypeAlias[typeList.size()]);
+ }
+
+ @Override
public CompilationUnit getCompilationUnit() {
return this;
}
@@ -1629,6 +1662,12 @@ public class CompilationUnitImpl extends SourceFileElementImpl<CompilationUnit>
}
DartTypeImpl type = new DartTypeImpl(this, tokenizer.nextToken());
return type.getHandleFromMemento(tokenizer, owner);
+ case MEMENTO_DELIMITER_CLASS_TYPE_ALIAS:
+ if (!tokenizer.hasMoreTokens()) {
+ return this;
+ }
+ DartClassTypeAliasImpl type2 = new DartClassTypeAliasImpl(this, tokenizer.nextToken());
+ return type2.getHandleFromMemento(tokenizer, owner);
case MEMENTO_DELIMITER_VARIABLE:
if (!tokenizer.hasMoreTokens()) {
return this;

Powered by Google App Engine
This is Rietveld 408576698