| 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, MemberKind, optional; | 10 import '../parser/parser.dart' show FormalParameterType, MemberKind, optional; |
| 11 | 11 |
| 12 import '../parser/identifier_context.dart' show IdentifierContext; | 12 import '../parser/identifier_context.dart' show IdentifierContext; |
| 13 | 13 |
| 14 import 'package:front_end/src/fasta/builder/ast_factory.dart' show AstFactory; | 14 import 'package:front_end/src/fasta/builder/ast_factory.dart' show AstFactory; |
| 15 | 15 |
| 16 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' | 16 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' |
| 17 show | 17 show |
| 18 KernelArguments, | 18 KernelArguments, |
| 19 KernelField, | 19 KernelField, |
| 20 KernelFunctionDeclaration, | 20 KernelFunctionDeclaration, |
| 21 KernelReturnStatement; | 21 KernelReturnStatement, |
| 22 KernelYieldStatement; |
| 22 | 23 |
| 23 import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken; | 24 import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken; |
| 24 | 25 |
| 25 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart' | 26 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart' |
| 26 show FieldNode; | 27 show FieldNode; |
| 27 | 28 |
| 28 import 'package:front_end/src/fasta/type_inference/type_inferrer.dart' | 29 import 'package:front_end/src/fasta/type_inference/type_inferrer.dart' |
| 29 show TypeInferrer; | 30 show TypeInferrer; |
| 30 | 31 |
| 31 import 'package:front_end/src/fasta/type_inference/type_promotion.dart' | 32 import 'package:front_end/src/fasta/type_inference/type_promotion.dart' |
| (...skipping 2279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 Token commaToken, Token rightParenthesis, Token semicolonToken) { | 2312 Token commaToken, Token rightParenthesis, Token semicolonToken) { |
| 2312 debugEvent("AssertStatement"); | 2313 debugEvent("AssertStatement"); |
| 2313 Expression message = popForValueIfNotNull(commaToken); | 2314 Expression message = popForValueIfNotNull(commaToken); |
| 2314 Expression condition = popForValue(); | 2315 Expression condition = popForValue(); |
| 2315 push(new AssertStatement(condition, message)); | 2316 push(new AssertStatement(condition, message)); |
| 2316 } | 2317 } |
| 2317 | 2318 |
| 2318 @override | 2319 @override |
| 2319 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) { | 2320 void endYieldStatement(Token yieldToken, Token starToken, Token endToken) { |
| 2320 debugEvent("YieldStatement"); | 2321 debugEvent("YieldStatement"); |
| 2321 push(new YieldStatement(popForValue(), isYieldStar: starToken != null) | 2322 push(new KernelYieldStatement(popForValue(), isYieldStar: starToken != null) |
| 2322 ..fileOffset = yieldToken.charOffset); | 2323 ..fileOffset = yieldToken.charOffset); |
| 2323 } | 2324 } |
| 2324 | 2325 |
| 2325 @override | 2326 @override |
| 2326 void beginSwitchBlock(Token token) { | 2327 void beginSwitchBlock(Token token) { |
| 2327 debugEvent("beginSwitchBlock"); | 2328 debugEvent("beginSwitchBlock"); |
| 2328 enterLocalScope(); | 2329 enterLocalScope(); |
| 2329 enterSwitchScope(); | 2330 enterSwitchScope(); |
| 2330 enterBreakTarget(token.charOffset); | 2331 enterBreakTarget(token.charOffset); |
| 2331 } | 2332 } |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3166 if (starToken == null) { | 3167 if (starToken == null) { |
| 3167 return AsyncMarker.Async; | 3168 return AsyncMarker.Async; |
| 3168 } else { | 3169 } else { |
| 3169 assert(identical(starToken.stringValue, "*")); | 3170 assert(identical(starToken.stringValue, "*")); |
| 3170 return AsyncMarker.AsyncStar; | 3171 return AsyncMarker.AsyncStar; |
| 3171 } | 3172 } |
| 3172 } else { | 3173 } else { |
| 3173 return internalError("Unknown async modifier: $asyncToken"); | 3174 return internalError("Unknown async modifier: $asyncToken"); |
| 3174 } | 3175 } |
| 3175 } | 3176 } |
| OLD | NEW |