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/kernel/body_builder.dart' show BodyBuilder; | 7 import 'package:front_end/src/fasta/kernel/body_builder.dart' show BodyBuilder; |
8 | 8 |
9 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' | 9 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' |
10 show KernelField; | 10 show KernelField; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 if (type != null) { | 65 if (type != null) { |
66 field.type = type.build(library); | 66 field.type = type.build(library); |
67 } | 67 } |
68 bool isInstanceMember = !isStatic && !isTopLevel; | 68 bool isInstanceMember = !isStatic && !isTopLevel; |
69 field | 69 field |
70 ..isFinal = isFinal | 70 ..isFinal = isFinal |
71 ..isConst = isConst | 71 ..isConst = isConst |
72 ..hasImplicitGetter = isInstanceMember | 72 ..hasImplicitGetter = isInstanceMember |
73 ..hasImplicitSetter = isInstanceMember && !isConst && !isFinal | 73 ..hasImplicitSetter = isInstanceMember && !isConst && !isFinal |
74 ..isStatic = !isInstanceMember; | 74 ..isStatic = !isInstanceMember; |
75 if (isEligibleForInference) { | 75 if (!library.disableTypeInference && isEligibleForInference) { |
76 library.loader.typeInferenceEngine.recordMember(field); | 76 library.loader.typeInferenceEngine.recordMember(field); |
77 } | 77 } |
78 return field; | 78 return field; |
79 } | 79 } |
80 | 80 |
81 Field get target => field; | 81 Field get target => field; |
82 | 82 |
83 @override | 83 @override |
84 void prepareInitializerInference( | 84 void prepareInitializerInference( |
85 SourceLibraryBuilder library, ClassBuilder currentClass) { | 85 SourceLibraryBuilder library, ClassBuilder currentClass) { |
86 if (isEligibleForInference) { | 86 if (!library.disableTypeInference && isEligibleForInference) { |
87 var memberScope = | 87 var memberScope = |
88 currentClass == null ? library.scope : currentClass.scope; | 88 currentClass == null ? library.scope : currentClass.scope; |
89 var typeInferenceEngine = library.loader.typeInferenceEngine; | 89 var typeInferenceEngine = library.loader.typeInferenceEngine; |
90 var listener = new TypeInferenceListener(); | 90 var listener = new TypeInferenceListener(); |
91 var typeInferrer = typeInferenceEngine.createTopLevelTypeInferrer( | 91 var typeInferrer = typeInferenceEngine.createTopLevelTypeInferrer( |
92 listener, field.enclosingClass?.thisType, field); | 92 listener, field.enclosingClass?.thisType, field); |
93 if (hasInitializer) { | 93 if (hasInitializer) { |
94 var bodyBuilder = new BodyBuilder( | 94 var bodyBuilder = new BodyBuilder( |
95 library, | 95 library, |
96 this, | 96 this, |
(...skipping 13 matching lines...) Expand all Loading... |
110 } | 110 } |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 @override | 114 @override |
115 DartType get builtType => field.type; | 115 DartType get builtType => field.type; |
116 | 116 |
117 @override | 117 @override |
118 bool get hasImplicitType => type == null; | 118 bool get hasImplicitType => type == null; |
119 } | 119 } |
OLD | NEW |