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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 void handleNoInitializers() { | 473 void handleNoInitializers() { |
474 debugEvent("NoInitializers"); | 474 debugEvent("NoInitializers"); |
475 } | 475 } |
476 | 476 |
477 @override | 477 @override |
478 void endInitializers(int count, Token beginToken, Token endToken) { | 478 void endInitializers(int count, Token beginToken, Token endToken) { |
479 debugEvent("Initializers"); | 479 debugEvent("Initializers"); |
480 } | 480 } |
481 | 481 |
482 @override | 482 @override |
483 void finishFunction( | 483 void finishFunction(FunctionNode function, FormalParameters formals, |
484 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { | 484 AsyncMarker asyncModifier, Statement body) { |
ahe
2017/05/24 16:00:21
You can access FunctionNode like this:
member.tar
Paul Berry
2017/05/24 16:20:16
Yes, that worked! Thank you, that makes this CL m
| |
485 debugEvent("finishFunction"); | 485 debugEvent("finishFunction"); |
486 typePromoter.finished(); | 486 typePromoter.finished(); |
487 // TODO(paulberry): get function return type from the outline. | 487 _typeInferrer.inferFunctionBody(function.returnType, asyncModifier, body); |
488 _typeInferrer.inferFunctionBody(null, asyncModifier, body); | |
489 KernelFunctionBuilder builder = member; | 488 KernelFunctionBuilder builder = member; |
490 builder.body = body; | 489 builder.body = body; |
491 if (formals?.optional != null) { | 490 if (formals?.optional != null) { |
492 Iterator<FormalParameterBuilder> formalBuilders = | 491 Iterator<FormalParameterBuilder> formalBuilders = |
493 builder.formals.skip(formals.required.length).iterator; | 492 builder.formals.skip(formals.required.length).iterator; |
494 for (VariableDeclaration parameter in formals.optional.formals) { | 493 for (VariableDeclaration parameter in formals.optional.formals) { |
495 bool hasMore = formalBuilders.moveNext(); | 494 bool hasMore = formalBuilders.moveNext(); |
496 assert(hasMore); | 495 assert(hasMore); |
497 VariableDeclaration realParameter = formalBuilders.current.target; | 496 VariableDeclaration realParameter = formalBuilders.current.target; |
498 Expression initializer = | 497 Expression initializer = |
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3188 if (starToken == null) { | 3187 if (starToken == null) { |
3189 return AsyncMarker.Async; | 3188 return AsyncMarker.Async; |
3190 } else { | 3189 } else { |
3191 assert(identical(starToken.stringValue, "*")); | 3190 assert(identical(starToken.stringValue, "*")); |
3192 return AsyncMarker.AsyncStar; | 3191 return AsyncMarker.AsyncStar; |
3193 } | 3192 } |
3194 } else { | 3193 } else { |
3195 return internalError("Unknown async modifier: $asyncToken"); | 3194 return internalError("Unknown async modifier: $asyncToken"); |
3196 } | 3195 } |
3197 } | 3196 } |
OLD | NEW |