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

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

Issue 2801873008: Throw isn't a constant expression. (Closed)
Patch Set: Created 3 years, 8 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/language/language_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 489a6bc10bddd4c2a254bd0045ac6a38a1a31b50..45faf3f7e6f0911d8b6796699b2593a33a16fbf9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1380,7 +1380,12 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper {
void endThrowExpression(Token throwToken, Token endToken) {
debugEvent("ThrowExpression");
Expression expression = popForValue();
- push(new Throw(expression)..fileOffset = throwToken.charOffset);
+ if (constantExpressionRequired) {
+ push(buildCompileTimeError(
+ "Not a constant expression.", throwToken.charOffset));
+ } else {
+ push(new Throw(expression)..fileOffset = throwToken.charOffset);
+ }
}
@override
« no previous file with comments | « no previous file | tests/language/language_kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698