| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |