Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
index d0970fa01290df1405f4ab3b91221e2d39c0cbcb..f74807b037d0d2829f642bd79a40330c3d6edea2 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
@@ -2151,6 +2151,11 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { |
String errorName; |
if (type is ClassBuilder) { |
+ if (type is EnumBuilder) { |
+ push(buildCompileTimeError( |
+ "An enum class can't be instantiated.", nameToken.charOffset)); |
+ return; |
+ } |
Builder b = |
type.findConstructorOrFactory(name, token.charOffset, uri, library); |
Member target; |