Skip to content

Commit

Permalink
CLI support for enableConditionalDirectives.
Browse files Browse the repository at this point in the history
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1778683004 .
  • Loading branch information
pq committed Mar 9, 2016
1 parent 402f27e commit fb3eae5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/analyzer_cli/lib/src/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ class Driver implements CommandLineStarter {
if (options.enableSuperMixins != _previousOptions.enableSuperMixins) {
return false;
}
if (options.enableConditionalDirectives !=
_previousOptions.enableConditionalDirectives) {
return false;
}
return true;
}

Expand Down Expand Up @@ -579,6 +583,8 @@ class Driver implements CommandLineStarter {
contextOptions.hint = !options.disableHints;
contextOptions.enableStrictCallChecks = options.enableStrictCallChecks;
contextOptions.enableSuperMixins = options.enableSuperMixins;
contextOptions.enableConditionalDirectives =
options.enableConditionalDirectives;
contextOptions.generateImplicitErrors = options.showPackageWarnings;
contextOptions.generateSdkErrors = options.showSdkWarnings;
contextOptions.lint = options.lints;
Expand Down
9 changes: 9 additions & 0 deletions pkg/analyzer_cli/lib/src/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class CommandLineOptions {
/// Whether to display version information
final bool displayVersion;

/// Whether to enable conditional directives (DEP 40).
final bool enableConditionalDirectives;

/// Whether to enable null-aware operators (DEP 9).
final bool enableNullAwareOperators;

Expand Down Expand Up @@ -128,6 +131,7 @@ class CommandLineOptions {
analysisOptionsFile = args['options'],
disableHints = args['no-hints'],
displayVersion = args['version'],
enableConditionalDirectives = args['enable-conditional-directives'],
enableNullAwareOperators = args['enable-null-aware-operators'],
enableStrictCallChecks = args['enable-strict-call-checks'],
enableSuperMixins = args['supermixin'],
Expand Down Expand Up @@ -335,6 +339,11 @@ class CommandLineOptions {
defaultsTo: false,
negatable: false,
hide: true)
..addFlag('enable-conditional-directives',
help: 'Enable support for conditional directives (DEP 40).',
defaultsTo: false,
negatable: false,
hide: true)
..addFlag('enable-null-aware-operators',
help: 'Enable support for null-aware operators (DEP 9).',
defaultsTo: false,
Expand Down
1 change: 1 addition & 0 deletions pkg/analyzer_cli/test/options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ main() {
expect(options.displayVersion, isFalse);
expect(options.enableStrictCallChecks, isFalse);
expect(options.enableSuperMixins, isFalse);
expect(options.enableConditionalDirectives, isFalse);
expect(options.enableTypeChecks, isFalse);
expect(options.hintsAreFatal, isFalse);
expect(options.ignoreUnrecognizedFlags, isFalse);
Expand Down

0 comments on commit fb3eae5

Please sign in to comment.