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

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

Issue 2899343002: Complain about function literals not being constant expressions. (Closed)
Patch Set: Created 3 years, 7 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 42d3a59efa81f35d779ece3d562a0f71cce3c456..e868b64fd5bf7a2150c2afb1d0f3fca63ef8fac5 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -2154,7 +2154,12 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
typeParameters: typeParameters, asyncMarker: asyncModifier)
..fileOffset = beginToken.charOffset
..fileEndOffset = token.charOffset);
- push(astFactory.functionExpression(function, beginToken));
+ if (constantExpressionRequired) {
+ push(buildCompileTimeError(
+ "Not a constant expression.", formals.charOffset));
+ } else {
+ push(astFactory.functionExpression(function, beginToken));
+ }
}
@override
« 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