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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2935593002: Attempt to instantiate an enum class is a compile-time error. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698