Index: pkg/analyzer_cli/lib/src/driver.dart |
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart |
index a4c2535d5a3a55881dad318e3e30a884d74174fa..070d06821fbfc2adee3da1eef04afe27dc1df162 100644 |
--- a/pkg/analyzer_cli/lib/src/driver.dart |
+++ b/pkg/analyzer_cli/lib/src/driver.dart |
@@ -588,10 +588,26 @@ class Driver implements CommandLineStarter { |
// to activate batch mode. |
if (sdk == null) { |
sdk = new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); |
+ sdk.analysisOptions = createAnalysisOptionsForCommandLineOptions(options); |
} |
_isBatch = options.shouldBatch; |
} |
+ static AnalysisOptionsImpl createAnalysisOptionsForCommandLineOptions( |
+ CommandLineOptions options) { |
+ AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); |
+ 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; |
+ contextOptions.strongMode = options.strongMode; |
+ return contextOptions; |
+ } |
+ |
static void setAnalysisContextOptions( |
AnalysisContext context, |
CommandLineOptions options, |
@@ -609,21 +625,12 @@ class Driver implements CommandLineStarter { |
} |
// Prepare context options. |
- AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); |
- 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; |
- contextOptions.strongMode = options.strongMode; |
+ AnalysisOptionsImpl contextOptions = |
+ createAnalysisOptionsForCommandLineOptions(options); |
configureContextOptions(contextOptions); |
// Set context options. |
context.analysisOptions = contextOptions; |
- context.sourceFactory.dartSdk.context.analysisOptions = contextOptions; |
// Process analysis options file (and notify all interested parties). |
_processAnalysisOptions(context, options); |