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

Side by Side Diff: pkg/analyzer_cli/lib/src/build_mode.dart

Issue 1882263002: Turn off summaries in context when building summary from AST. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer_cli.src.build_mode; 5 library analyzer_cli.src.build_mode;
6 6
7 import 'dart:core' hide Resource; 7 import 'dart:core' hide Resource;
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; 10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 } 151 }
152 return maxSeverity; 152 return maxSeverity;
153 } 153 }
154 154
155 void _createContext() { 155 void _createContext() {
156 DirectoryBasedDartSdk sdk = 156 DirectoryBasedDartSdk sdk =
157 new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); 157 new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath));
158 sdk.analysisOptions = 158 sdk.analysisOptions =
159 Driver.createAnalysisOptionsForCommandLineOptions(options); 159 Driver.createAnalysisOptionsForCommandLineOptions(options);
160 sdk.useSummary = true; 160 sdk.useSummary = !options.buildSummaryOnlyAst;
161 161
162 // Read the summaries. 162 // Read the summaries.
163 summaryDataStore = new SummaryDataStore(options.buildSummaryInputs); 163 summaryDataStore = new SummaryDataStore(options.buildSummaryInputs);
164 164
165 // In AST mode include SDK bundle to avoid parsing SDK sources. 165 // In AST mode include SDK bundle to avoid parsing SDK sources.
166 if (options.buildSummaryOnlyAst) { 166 if (options.buildSummaryOnlyAst) {
167 summaryDataStore.addBundle(null, sdk.getSummarySdkBundle()); 167 summaryDataStore.addBundle(null, sdk.getSummarySdkBundle());
168 } 168 }
169 169
170 // Create the context. 170 // Create the context.
171 context = AnalysisEngine.instance.createAnalysisContext(); 171 context = AnalysisEngine.instance.createAnalysisContext();
172 context.sourceFactory = new SourceFactory(<UriResolver>[ 172 context.sourceFactory = new SourceFactory(<UriResolver>[
173 new DartUriResolver(sdk), 173 new DartUriResolver(sdk),
174 new InSummaryPackageUriResolver(summaryDataStore), 174 new InSummaryPackageUriResolver(summaryDataStore),
175 new ExplicitSourceResolver(uriToFileMap) 175 new ExplicitSourceResolver(uriToFileMap)
176 ]); 176 ]);
177 177
178 // Set context options. 178 // Set context options.
179 Driver.setAnalysisContextOptions(context, options, 179 Driver.setAnalysisContextOptions(context, options,
180 (AnalysisOptionsImpl contextOptions) { 180 (AnalysisOptionsImpl contextOptions) {
181 if (options.buildSummaryOnlyDiet) { 181 if (options.buildSummaryOnlyDiet) {
182 contextOptions.analyzeFunctionBodies = false; 182 contextOptions.analyzeFunctionBodies = false;
183 } 183 }
184 }); 184 });
185 185
186 // Configure using summaries. 186 if (!options.buildSummaryOnlyAst) {
187 context.typeProvider = sdk.context.typeProvider; 187 // Configure using summaries.
188 context.resultProvider = 188 context.typeProvider = sdk.context.typeProvider;
189 new InputPackagesResultProvider(context, summaryDataStore); 189 context.resultProvider =
190 new InputPackagesResultProvider(context, summaryDataStore);
191 }
190 } 192 }
191 193
192 /** 194 /**
193 * Print errors for all explicit sources. If [outputPath] is supplied, output 195 * Print errors for all explicit sources. If [outputPath] is supplied, output
194 * is sent to a new file at that path. 196 * is sent to a new file at that path.
195 */ 197 */
196 void _printErrors({String outputPath}) { 198 void _printErrors({String outputPath}) {
197 StringBuffer buffer = new StringBuffer(); 199 StringBuffer buffer = new StringBuffer();
198 ErrorFormatter formatter = new ErrorFormatter( 200 ErrorFormatter formatter = new ErrorFormatter(
199 buffer, 201 buffer,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 String msg = ''; 407 String msg = '';
406 if (errorBuffer.isNotEmpty) { 408 if (errorBuffer.isNotEmpty) {
407 msg += errorBuffer.toString() + '\n'; 409 msg += errorBuffer.toString() + '\n';
408 } 410 }
409 if (outBuffer.isNotEmpty) { 411 if (outBuffer.isNotEmpty) {
410 msg += outBuffer.toString() + '\n'; 412 msg += outBuffer.toString() + '\n';
411 } 413 }
412 return msg; 414 return msg;
413 } 415 }
414 } 416 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698