Index: compiler/java/com/google/dart/compiler/ast/DartClassTypeAlias.java |
diff --git a/compiler/java/com/google/dart/compiler/ast/DartClassTypeAlias.java b/compiler/java/com/google/dart/compiler/ast/DartClassTypeAlias.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9fa309f5f6169e9cf9774c7b5605265a62cad76 |
--- /dev/null |
+++ b/compiler/java/com/google/dart/compiler/ast/DartClassTypeAlias.java |
@@ -0,0 +1,88 @@ |
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+package com.google.dart.compiler.ast; |
+ |
+import com.google.dart.compiler.resolver.ClassNodeElement; |
+import com.google.dart.compiler.resolver.Element; |
+ |
+import java.util.List; |
+ |
+/** |
+ * Instances of the class {@code DartClassTypeAlias} represent a class type alias. |
+ */ |
+public class DartClassTypeAlias extends DartDeclaration<DartIdentifier> { |
+ private final NodeList<DartTypeParameter> typeParameters = NodeList.create(this); |
+ private final Modifiers modifiers; |
+ private final DartTypeNode superclass; |
+ private final NodeList<DartTypeNode> mixins = NodeList.create(this); |
+ private final NodeList<DartTypeNode> interfaces = NodeList.create(this); |
+ private ClassNodeElement element; |
+ |
+ public DartClassTypeAlias(DartIdentifier name, List<DartTypeParameter> typeParameters, |
+ Modifiers modifiers, DartTypeNode superclass, List<DartTypeNode> mixins, |
+ List<DartTypeNode> interfaces) { |
+ super(name); |
+ this.typeParameters.addAll(typeParameters); |
+ this.modifiers = modifiers; |
+ this.superclass = superclass; |
+ this.mixins.addAll(mixins); |
+ this.interfaces.addAll(interfaces); |
+ } |
+ |
+ public List<DartTypeParameter> getTypeParameters() { |
+ return typeParameters; |
+ } |
+ |
+ public Modifiers getModifiers() { |
+ return modifiers; |
+ } |
+ |
+ public boolean isAbstract() { |
+ return modifiers.isAbstract(); |
+ } |
+ |
+ public DartTypeNode getSuperclass() { |
+ return superclass; |
+ } |
+ |
+ public NodeList<DartTypeNode> getMixins() { |
+ return mixins; |
+ } |
+ |
+ public List<DartTypeNode> getInterfaces() { |
+ return interfaces; |
+ } |
+ |
+ public String getClassName() { |
+ if (getName() == null) { |
+ return null; |
+ } |
+ return getName().getName(); |
+ } |
+ |
+ @Override |
+ public ClassNodeElement getElement() { |
+ return element; |
+ } |
+ |
+ @Override |
+ public void setElement(Element element) { |
+ this.element = (ClassNodeElement) element; |
+ } |
+ |
+ @Override |
+ public void visitChildren(ASTVisitor<?> visitor) { |
+ super.visitChildren(visitor); |
+ typeParameters.accept(visitor); |
+ superclass.accept(visitor); |
+ mixins.accept(visitor); |
+ interfaces.accept(visitor); |
+ } |
+ |
+ @Override |
+ public <R> R accept(ASTVisitor<R> visitor) { |
+ return visitor.visitClassTypeAlias(this); |
+ } |
+} |