Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/kernel_field_builder.dart

Issue 2962913002: Create an option to disable type inference and type promotion. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698