Index: pkg/compiler/lib/src/resolution/members.dart |
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart |
index 937d308a4afbc195fa6be76d78d86e5b2586eeb7..8159d4a009425f8b4df36f68828b86130de38d47 100644 |
--- a/pkg/compiler/lib/src/resolution/members.dart |
+++ b/pkg/compiler/lib/src/resolution/members.dart |
@@ -4335,6 +4335,26 @@ class ClassResolverVisitor extends TypeDefinitionVisitor { |
return element.computeType(compiler); |
} |
+ @override |
+ DartType visitEnum(Enum node) { |
+ if (!compiler.enableEnums) { |
+ compiler.reportError(node, MessageKind.EXPERIMENTAL_ENUMS); |
+ } |
+ |
+ invariant(node, element != null); |
+ invariant(element, element.resolutionState == STATE_STARTED, |
+ message: () => 'cyclic resolution of class $element'); |
+ |
+ InterfaceType enumType = element.computeType(compiler); |
+ element.supertype = compiler.objectClass.computeType(compiler); |
+ element.interfaces = const Link<DartType>(); |
+ calculateAllSupertypes(element); |
+ |
+ EnumCreator creator = new EnumCreator(compiler, element); |
+ creator.createMembers(); |
+ return enumType; |
+ } |
+ |
/// Resolves the mixed type for [mixinNode] and checks that the the mixin type |
/// is a valid, non-blacklisted interface type. The mixin type is returned. |
DartType checkMixinType(TypeAnnotation mixinNode) { |
@@ -4701,6 +4721,10 @@ class ClassSupertypeResolver extends CommonResolverVisitor { |
visitNodeList(node.interfaces); |
} |
+ void visitEnum(Enum node) { |
+ loadSupertype(compiler.objectClass, node); |
+ } |
+ |
void visitMixinApplication(MixinApplication node) { |
node.superclass.accept(this); |
visitNodeList(node.mixins); |