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

Unified Diff: pkg/analyzer_cli/lib/src/driver.dart

Issue 2976683002: Refactor creating AnalysisOptionsImpl and declared variables. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer_cli/lib/src/build_mode.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ab6f945337e41ed21ac911da61a66cacd80bdb88..8c25eed8b4e512c1f3a30aaf89b0e21311f7ca1e 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -584,6 +584,11 @@ class Driver implements CommandLineStarter {
return;
}
+ // Set up logging.
+ if (options.log) {
+ AnalysisEngine.instance.logger = new StdLogger();
+ }
+
// Save stats from previous context before clobbering it.
if (_context != null) {
_analyzedFileCount += _context.sources.length;
@@ -626,8 +631,9 @@ class Driver implements CommandLineStarter {
// Create a context.
_context = AnalysisEngine.instance.createAnalysisContext();
- setupAnalysisContext(_context, options, analysisOptions);
+ _context.analysisOptions = analysisOptions;
_context.sourceFactory = sourceFactory;
+ declareVariables(context.declaredVariables, options);
if (options.enableNewAnalysisDriver) {
PerformanceLog log = new PerformanceLog(null);
@@ -861,31 +867,15 @@ class Driver implements CommandLineStarter {
return contextOptions;
}
- static void setAnalysisContextOptions(
- file_system.ResourceProvider resourceProvider,
- AnalysisContext context,
- CommandLineOptions options) {
- AnalysisOptionsImpl analysisOptions =
- createAnalysisOptionsForCommandLineOptions(resourceProvider, options);
- setupAnalysisContext(context, options, analysisOptions);
- }
-
- static void setupAnalysisContext(AnalysisContext context,
- CommandLineOptions options, AnalysisOptionsImpl analysisOptions) {
+ /// Copy variables defined in the [options] into [declaredVariables].
+ static void declareVariables(
+ DeclaredVariables declaredVariables, CommandLineOptions options) {
Map<String, String> definedVariables = options.definedVariables;
if (definedVariables.isNotEmpty) {
- DeclaredVariables declaredVariables = context.declaredVariables;
definedVariables.forEach((String variableName, String value) {
declaredVariables.define(variableName, value);
});
}
-
- if (options.log) {
- AnalysisEngine.instance.logger = new StdLogger();
- }
-
- // Set context options.
- context.analysisOptions = analysisOptions;
}
/// Return whether the [newOptions] are equal to the [previous].
« no previous file with comments | « pkg/analyzer_cli/lib/src/build_mode.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698