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.kernel_field_builder; | 5 library fasta.kernel_field_builder; |
6 | 6 |
7 import 'package:front_end/src/fasta/builder/ast_factory.dart' show AstFactory; | 7 import 'package:front_end/src/fasta/builder/ast_factory.dart' show AstFactory; |
8 | 8 |
9 import 'package:front_end/src/fasta/kernel/body_builder.dart' show BodyBuilder; | 9 import 'package:front_end/src/fasta/kernel/body_builder.dart' show BodyBuilder; |
10 | 10 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 Field get target => field; | 75 Field get target => field; |
76 | 76 |
77 @override | 77 @override |
78 void prepareInitializerInference(TypeInferenceEngine typeInferenceEngine, | 78 void prepareInitializerInference(TypeInferenceEngine typeInferenceEngine, |
79 LibraryBuilder library, ClassBuilder currentClass) { | 79 LibraryBuilder library, ClassBuilder currentClass) { |
80 if (initializerToken != null) { | 80 if (initializerToken != null) { |
81 var memberScope = | 81 var memberScope = |
82 currentClass == null ? library.scope : currentClass.scope; | 82 currentClass == null ? library.scope : currentClass.scope; |
83 // TODO(paulberry): Is it correct to pass library.uri into BodyBuilder, or | 83 // TODO(paulberry): Is it correct to pass library.uri into BodyBuilder, or |
84 // should it be the part URI? | 84 // should it be the part URI? |
| 85 var typeInferrer = typeInferenceEngine.createTopLevelTypeInferrer(field); |
85 var bodyBuilder = new BodyBuilder( | 86 var bodyBuilder = new BodyBuilder( |
86 library, | 87 library, |
87 this, | 88 this, |
88 memberScope, | 89 memberScope, |
89 null, | 90 null, |
90 typeInferenceEngine.classHierarchy, | 91 typeInferenceEngine.classHierarchy, |
91 typeInferenceEngine.coreTypes, | 92 typeInferenceEngine.coreTypes, |
92 currentClass, | 93 currentClass, |
93 isInstanceMember, | 94 isInstanceMember, |
94 library.uri, | 95 library.uri, |
95 typeInferenceEngine.createTopLevelTypeInferrer(field), | 96 typeInferrer, |
96 astFactory, | 97 astFactory, |
97 fieldDependencies: typeInferenceEngine.getFieldDependencies(field)); | 98 fieldDependencies: typeInferenceEngine.getFieldDependencies(field)); |
98 Parser parser = new Parser(bodyBuilder); | 99 Parser parser = new Parser(bodyBuilder); |
99 Token token = parser.parseExpression(initializerToken); | 100 Token token = parser.parseExpression(initializerToken); |
100 Expression expression = bodyBuilder.popForValue(); | 101 Expression expression = bodyBuilder.popForValue(); |
101 bodyBuilder.checkEmpty(token.charOffset); | 102 bodyBuilder.checkEmpty(token.charOffset); |
102 initializer = expression; | 103 initializer = expression; |
103 } | 104 } |
104 } | 105 } |
105 } | 106 } |
OLD | NEW |