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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests/language/language_kernel.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import '../fasta_codes.dart' 7 import '../fasta_codes.dart'
8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; 8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody;
9 9
10 import '../parser/parser.dart' show FormalParameterType, optional; 10 import '../parser/parser.dart' show FormalParameterType, optional;
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 Expression thenExpression = popForValue(); 1373 Expression thenExpression = popForValue();
1374 Expression condition = popForValue(); 1374 Expression condition = popForValue();
1375 push(new ConditionalExpression( 1375 push(new ConditionalExpression(
1376 condition, thenExpression, elseExpression, const DynamicType())); 1376 condition, thenExpression, elseExpression, const DynamicType()));
1377 } 1377 }
1378 1378
1379 @override 1379 @override
1380 void endThrowExpression(Token throwToken, Token endToken) { 1380 void endThrowExpression(Token throwToken, Token endToken) {
1381 debugEvent("ThrowExpression"); 1381 debugEvent("ThrowExpression");
1382 Expression expression = popForValue(); 1382 Expression expression = popForValue();
1383 push(new Throw(expression)..fileOffset = throwToken.charOffset); 1383 if (constantExpressionRequired) {
1384 push(buildCompileTimeError(
1385 "Not a constant expression.", throwToken.charOffset));
1386 } else {
1387 push(new Throw(expression)..fileOffset = throwToken.charOffset);
1388 }
1384 } 1389 }
1385 1390
1386 @override 1391 @override
1387 void endFormalParameter(Token covariantKeyword, Token thisKeyword, 1392 void endFormalParameter(Token covariantKeyword, Token thisKeyword,
1388 Token nameToken, FormalParameterType kind) { 1393 Token nameToken, FormalParameterType kind) {
1389 debugEvent("FormalParameter"); 1394 debugEvent("FormalParameter");
1390 // TODO(ahe): Need beginToken here. 1395 // TODO(ahe): Need beginToken here.
1391 int charOffset = thisKeyword?.charOffset; 1396 int charOffset = thisKeyword?.charOffset;
1392 if (thisKeyword != null) { 1397 if (thisKeyword != null) {
1393 if (!inConstructor) { 1398 if (!inConstructor) {
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 } else if (node is PrefixBuilder) { 2959 } else if (node is PrefixBuilder) {
2955 return node.name; 2960 return node.name;
2956 } else if (node is ThisAccessor) { 2961 } else if (node is ThisAccessor) {
2957 return node.isSuper ? "super" : "this"; 2962 return node.isSuper ? "super" : "this";
2958 } else if (node is FastaAccessor) { 2963 } else if (node is FastaAccessor) {
2959 return node.plainNameForRead; 2964 return node.plainNameForRead;
2960 } else { 2965 } else {
2961 return internalError("Unhandled: ${node.runtimeType}"); 2966 return internalError("Unhandled: ${node.runtimeType}");
2962 } 2967 }
2963 } 2968 }
OLDNEW
« 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