@@ -25,7 +25,7 @@ class ResolverOptions {
25
25
26
26
/// Whether to infer return types and field types from overriden members.
27
27
final bool inferFromOverrides;
28
- static const bool INFER_FROM_OVERRIDES_DEFAULT = false ;
28
+ static const inferFromOverridesDefault = false ;
29
29
30
30
/// Whether to infer types for consts and static fields by looking at
31
31
/// identifiers on the RHS. For example, in a constant declaration like:
@@ -37,6 +37,7 @@ class ResolverOptions {
37
37
/// defined in a different library than `A` . Because this might be surprising
38
38
/// to users, this is turned off by default.
39
39
final bool inferStaticsFromIdentifiers;
40
+ static const inferStaticsFromIdentifiersDefault = false ;
40
41
41
42
/// Whether to ignore ordering issues and do a best effort in inference. When
42
43
/// false, inference of top-levels and statics is limited to only consider
@@ -49,17 +50,19 @@ class ResolverOptions {
49
50
/// implementation of inference in the future, which should handle all
50
51
/// ordering concerns.
51
52
final bool inferInNonStableOrder;
53
+ static const inferInNonStableOrderDefault = false ;
52
54
53
55
/// Restrict inference of fields and top-levels to those that are final and
54
56
/// const.
55
57
final bool onlyInferConstsAndFinalFields;
58
+ static const onlyInferConstAndFinalFieldsDefault = false ;
56
59
57
60
ResolverOptions ({this .useMultiPackage: false , this .packageRoot: 'packages/' ,
58
61
this .packagePaths: const < String > [],
59
- this .inferFromOverrides: INFER_FROM_OVERRIDES_DEFAULT ,
60
- this .inferStaticsFromIdentifiers: false ,
61
- this .inferInNonStableOrder: false ,
62
- this .onlyInferConstsAndFinalFields: false });
62
+ this .inferFromOverrides: inferFromOverridesDefault ,
63
+ this .inferStaticsFromIdentifiers: inferStaticsFromIdentifiersDefault ,
64
+ this .inferInNonStableOrder: inferInNonStableOrderDefault ,
65
+ this .onlyInferConstsAndFinalFields: onlyInferConstAndFinalFieldsDefault });
63
66
}
64
67
65
68
// TODO(vsm): Merge RulesOptions and TypeOptions
@@ -207,10 +210,10 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions {
207
210
this .covariantGenerics: true , this .relaxedCasts: true ,
208
211
this .useMultiPackage: false , this .packageRoot: 'packages/' ,
209
212
this .packagePaths: const < String > [],
210
- this .inferFromOverrides: ResolverOptions .INFER_FROM_OVERRIDES_DEFAULT ,
211
- this .inferStaticsFromIdentifiers: false ,
212
- this .inferInNonStableOrder: false ,
213
- this .onlyInferConstsAndFinalFields: false ,
213
+ this .inferFromOverrides: ResolverOptions .inferFromOverridesDefault ,
214
+ this .inferStaticsFromIdentifiers: ResolverOptions .inferStaticsFromIdentifiersDefault ,
215
+ this .inferInNonStableOrder: ResolverOptions .inferInNonStableOrderDefault ,
216
+ this .onlyInferConstsAndFinalFields: ResolverOptions .onlyInferConstAndFinalFieldsDefault ,
214
217
this .nonnullableTypes: TypeOptions .NONNULLABLE_TYPES , this .help: false ,
215
218
this .useMockSdk: false , this .dartSdkPath, this .logLevel: Level .SEVERE ,
216
219
this .emitSourceMaps: true , this .entryPointFile: null ,
@@ -281,16 +284,18 @@ final ArgParser argParser = new ArgParser()
281
284
..addFlag ('infer-from-overrides' ,
282
285
help: 'Infer unspecified types of fields and return types from '
283
286
'definitions in supertypes' ,
284
- defaultsTo: ResolverOptions .INFER_FROM_OVERRIDES_DEFAULT )
287
+ defaultsTo: ResolverOptions .inferFromOverridesDefault )
285
288
..addFlag ('infer-transitively' ,
286
289
help: 'Infer consts/fields from definitions in other libraries' ,
287
- defaultsTo: false )
290
+ defaultsTo: ResolverOptions .inferStaticsFromIdentifiersDefault )
288
291
..addFlag ('infer-only-finals' ,
289
- help: 'Do not infer non-const or non-final fields' , defaultsTo: false )
292
+ help: 'Do not infer non-const or non-final fields' ,
293
+ defaultsTo: ResolverOptions .onlyInferConstAndFinalFieldsDefault)
290
294
..addFlag ('infer-eagerly' ,
291
295
help: 'experimental: allows a non-stable order of transitive inference on'
292
296
' consts and fields. This is used to test for possible inference with a '
293
- 'proper implementation in the future.' , defaultsTo: false )
297
+ 'proper implementation in the future.' ,
298
+ defaultsTo: ResolverOptions .inferInNonStableOrderDefault)
294
299
295
300
// input/output options
296
301
..addOption ('out' , abbr: 'o' , help: 'Output directory' , defaultsTo: null )
0 commit comments