| 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; |
| 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 KernelField, KernelVariableDeclaration; | 17 show KernelField, KernelVariableDeclaration; |
| 18 | 18 |
| 19 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart' |
| 20 show FieldNode; |
| 21 |
| 19 import 'package:front_end/src/fasta/type_inference/type_inferrer.dart' | 22 import 'package:front_end/src/fasta/type_inference/type_inferrer.dart' |
| 20 show FieldNode, TypeInferrer; | 23 show TypeInferrer; |
| 21 | 24 |
| 22 import 'package:kernel/ast.dart'; | 25 import 'package:kernel/ast.dart'; |
| 23 | 26 |
| 24 import 'package:kernel/clone.dart' show CloneVisitor; | 27 import 'package:kernel/clone.dart' show CloneVisitor; |
| 25 | 28 |
| 26 import 'package:kernel/transformations/flags.dart' show TransformerFlag; | 29 import 'package:kernel/transformations/flags.dart' show TransformerFlag; |
| 27 | 30 |
| 28 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; | 31 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
| 29 | 32 |
| 30 import 'package:kernel/core_types.dart' show CoreTypes; | 33 import 'package:kernel/core_types.dart' show CoreTypes; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 448 |
| 446 @override | 449 @override |
| 447 void endInitializers(int count, Token beginToken, Token endToken) { | 450 void endInitializers(int count, Token beginToken, Token endToken) { |
| 448 debugEvent("Initializers"); | 451 debugEvent("Initializers"); |
| 449 } | 452 } |
| 450 | 453 |
| 451 @override | 454 @override |
| 452 void finishFunction( | 455 void finishFunction( |
| 453 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { | 456 FormalParameters formals, AsyncMarker asyncModifier, Statement body) { |
| 454 debugEvent("finishFunction"); | 457 debugEvent("finishFunction"); |
| 455 _typeInferrer.inferBody(body, uri); | 458 _typeInferrer.inferStatement(body); |
| 456 KernelFunctionBuilder builder = member; | 459 KernelFunctionBuilder builder = member; |
| 457 builder.body = body; | 460 builder.body = body; |
| 458 if (formals?.optional != null) { | 461 if (formals?.optional != null) { |
| 459 Iterator<FormalParameterBuilder> formalBuilders = | 462 Iterator<FormalParameterBuilder> formalBuilders = |
| 460 builder.formals.skip(formals.required.length).iterator; | 463 builder.formals.skip(formals.required.length).iterator; |
| 461 for (VariableDeclaration parameter in formals.optional.formals) { | 464 for (VariableDeclaration parameter in formals.optional.formals) { |
| 462 bool hasMore = formalBuilders.moveNext(); | 465 bool hasMore = formalBuilders.moveNext(); |
| 463 assert(hasMore); | 466 assert(hasMore); |
| 464 VariableDeclaration realParameter = formalBuilders.current.target; | 467 VariableDeclaration realParameter = formalBuilders.current.target; |
| 465 Expression initializer = parameter.initializer ?? new NullLiteral(); | 468 Expression initializer = parameter.initializer ?? new NullLiteral(); |
| (...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3091 } else if (node is PrefixBuilder) { | 3094 } else if (node is PrefixBuilder) { |
| 3092 return node.name; | 3095 return node.name; |
| 3093 } else if (node is ThisAccessor) { | 3096 } else if (node is ThisAccessor) { |
| 3094 return node.isSuper ? "super" : "this"; | 3097 return node.isSuper ? "super" : "this"; |
| 3095 } else if (node is FastaAccessor) { | 3098 } else if (node is FastaAccessor) { |
| 3096 return node.plainNameForRead; | 3099 return node.plainNameForRead; |
| 3097 } else { | 3100 } else { |
| 3098 return internalError("Unhandled: ${node.runtimeType}"); | 3101 return internalError("Unhandled: ${node.runtimeType}"); |
| 3099 } | 3102 } |
| 3100 } | 3103 } |
| OLD | NEW |