| 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 @override | 440 @override |
| 441 void endInitializers(int count, Token beginToken, Token endToken) { | 441 void endInitializers(int count, Token beginToken, Token endToken) { |
| 442 debugEvent("Initializers"); | 442 debugEvent("Initializers"); |
| 443 } | 443 } |
| 444 | 444 |
| 445 @override | 445 @override |
| 446 void finishFunction( | 446 void finishFunction( |
| 447 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { | 447 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { |
| 448 debugEvent("finishFunction"); | 448 debugEvent("finishFunction"); |
| 449 _typeInferrer?.inferBody(body, uri); | 449 _typeInferrer.inferBody(body, uri); |
| 450 KernelFunctionBuilder builder = member; | 450 KernelFunctionBuilder builder = member; |
| 451 builder.body = body; | 451 builder.body = body; |
| 452 if (formals?.optional != null) { | 452 if (formals?.optional != null) { |
| 453 Iterator<FormalParameterBuilder> formalBuilders = | 453 Iterator<FormalParameterBuilder> formalBuilders = |
| 454 builder.formals.skip(formals.required.length).iterator; | 454 builder.formals.skip(formals.required.length).iterator; |
| 455 for (VariableDeclaration parameter in formals.optional.formals) { | 455 for (VariableDeclaration parameter in formals.optional.formals) { |
| 456 bool hasMore = formalBuilders.moveNext(); | 456 bool hasMore = formalBuilders.moveNext(); |
| 457 assert(hasMore); | 457 assert(hasMore); |
| 458 VariableDeclaration realParameter = formalBuilders.current.target; | 458 VariableDeclaration realParameter = formalBuilders.current.target; |
| 459 Expression initializer = parameter.initializer ?? new NullLiteral(); | 459 Expression initializer = parameter.initializer ?? new NullLiteral(); |
| (...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3074 } else if (node is PrefixBuilder) { | 3074 } else if (node is PrefixBuilder) { |
| 3075 return node.name; | 3075 return node.name; |
| 3076 } else if (node is ThisAccessor) { | 3076 } else if (node is ThisAccessor) { |
| 3077 return node.isSuper ? "super" : "this"; | 3077 return node.isSuper ? "super" : "this"; |
| 3078 } else if (node is FastaAccessor) { | 3078 } else if (node is FastaAccessor) { |
| 3079 return node.plainNameForRead; | 3079 return node.plainNameForRead; |
| 3080 } else { | 3080 } else { |
| 3081 return internalError("Unhandled: ${node.runtimeType}"); | 3081 return internalError("Unhandled: ${node.runtimeType}"); |
| 3082 } | 3082 } |
| 3083 } | 3083 } |
| OLD | NEW |