| 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; |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 @override | 460 @override |
| 461 void endInitializers(int count, Token beginToken, Token endToken) { | 461 void endInitializers(int count, Token beginToken, Token endToken) { |
| 462 debugEvent("Initializers"); | 462 debugEvent("Initializers"); |
| 463 } | 463 } |
| 464 | 464 |
| 465 @override | 465 @override |
| 466 void finishFunction( | 466 void finishFunction( |
| 467 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { | 467 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { |
| 468 debugEvent("finishFunction"); | 468 debugEvent("finishFunction"); |
| 469 typePromoter.finished(); | 469 typePromoter.finished(); |
| 470 _typeInferrer.inferStatement(body); | 470 // TODO(paulberry): get function return type from the outline. |
| 471 _typeInferrer.inferFunctionBody(null, asyncModifier, body); |
| 471 KernelFunctionBuilder builder = member; | 472 KernelFunctionBuilder builder = member; |
| 472 builder.body = body; | 473 builder.body = body; |
| 473 if (formals?.optional != null) { | 474 if (formals?.optional != null) { |
| 474 Iterator<FormalParameterBuilder> formalBuilders = | 475 Iterator<FormalParameterBuilder> formalBuilders = |
| 475 builder.formals.skip(formals.required.length).iterator; | 476 builder.formals.skip(formals.required.length).iterator; |
| 476 for (VariableDeclaration parameter in formals.optional.formals) { | 477 for (VariableDeclaration parameter in formals.optional.formals) { |
| 477 bool hasMore = formalBuilders.moveNext(); | 478 bool hasMore = formalBuilders.moveNext(); |
| 478 assert(hasMore); | 479 assert(hasMore); |
| 479 VariableDeclaration realParameter = formalBuilders.current.target; | 480 VariableDeclaration realParameter = formalBuilders.current.target; |
| 480 Expression initializer = | 481 Expression initializer = |
| (...skipping 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3167 if (starToken == null) { | 3168 if (starToken == null) { |
| 3168 return AsyncMarker.Async; | 3169 return AsyncMarker.Async; |
| 3169 } else { | 3170 } else { |
| 3170 assert(identical(starToken.stringValue, "*")); | 3171 assert(identical(starToken.stringValue, "*")); |
| 3171 return AsyncMarker.AsyncStar; | 3172 return AsyncMarker.AsyncStar; |
| 3172 } | 3173 } |
| 3173 } else { | 3174 } else { |
| 3174 return internalError("Unknown async modifier: $asyncToken"); | 3175 return internalError("Unknown async modifier: $asyncToken"); |
| 3175 } | 3176 } |
| 3176 } | 3177 } |
| OLD | NEW |