Chromium Code Reviews| Index: lib/src/options.dart |
| diff --git a/lib/src/options.dart b/lib/src/options.dart |
| index 080c93fc336cfce72eece80e65b691616ee01734..104d6e60a5c17bf44a95e9fb04853c5e9e101aef 100644 |
| --- a/lib/src/options.dart |
| +++ b/lib/src/options.dart |
| @@ -67,6 +67,10 @@ class RulesOptions extends TypeOptions { |
| /// Whether to use covariant generics |
| final bool covariantGenerics; |
| + /// Whether to infer types downwards from local context |
| + final bool inferDownwards; |
| + static const inferDownwardsDefault = true; |
| + |
| /// Whether to inject casts between Dart assignable types. |
| final bool relaxedCasts; |
| @@ -77,8 +81,8 @@ class RulesOptions extends TypeOptions { |
| final bool wrapClosures; |
| RulesOptions({this.allowConstCasts: true, this.covariantGenerics: true, |
| - this.relaxedCasts: true, this.ignoreTypes: false, |
| - this.wrapClosures: true}); |
| + this.inferDownwards: inferDownwardsDefault, this.relaxedCasts: true, |
| + this.ignoreTypes: false, this.wrapClosures: true}); |
| } |
| class JSCodeOptions { |
| @@ -172,6 +176,10 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions { |
| @override |
| final List<String> packagePaths; |
| + /// Whether to infer types downwards from local context |
| + @override |
| + final bool inferDownwards; |
| + |
| /// Whether to infer return types and field types from overriden members. |
| @override |
| final bool inferFromOverrides; |
| @@ -215,6 +223,7 @@ class CompilerOptions implements RulesOptions, ResolverOptions, JSCodeOptions { |
| this.useColors: true, this.covariantGenerics: true, |
| this.relaxedCasts: true, this.useMultiPackage: false, |
| this.packageRoot: 'packages/', this.packagePaths: const <String>[], |
| + this.inferDownwards: RulesOptions.inferDownwardsDefault, |
| this.inferFromOverrides: ResolverOptions.inferFromOverridesDefault, |
| this.inferTransitively: ResolverOptions.inferTransitivelyDefault, |
| this.onlyInferConstsAndFinalFields: ResolverOptions.onlyInferConstAndFinalFieldsDefault, |
| @@ -270,6 +279,7 @@ CompilerOptions parseOptions(List<String> argv) { |
| useMultiPackage: args['use-multi-package'], |
| packageRoot: args['package-root'], |
| packagePaths: args['package-paths'].split(','), |
| + inferDownwards: args['infer-downwards'], |
| inferFromOverrides: args['infer-from-overrides'], |
| inferTransitively: args['infer-transitively'], |
| onlyInferConstsAndFinalFields: args['infer-only-finals'], |
| @@ -306,6 +316,8 @@ final ArgParser argParser = new ArgParser() |
| abbr: 'n', |
| help: 'Comma separated string of non-nullable types', |
| defaultsTo: null) |
| + ..addFlag('infer-downwards', |
| + help: 'Infer types downwards from local context', defaultsTo: true) |
|
vsm
2015/03/27 21:20:59
s/true/RulesOptions.inferDownwardsDefault/
Leaf
2015/03/30 23:26:00
Done.
|
| ..addFlag('infer-from-overrides', |
| help: 'Infer unspecified types of fields and return types from\n' |
| 'definitions in supertypes', |