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

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 842533004: Return outline after parse (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import "dart:math" as math; 10 import "dart:math" as math;
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2363 } else { 2363 } else {
2364 dartEntry.recordResolutionErrorInLibrary( 2364 dartEntry.recordResolutionErrorInLibrary(
2365 librarySource, 2365 librarySource,
2366 thrownException); 2366 thrownException);
2367 } 2367 }
2368 if (source != librarySource) { 2368 if (source != librarySource) {
2369 _workManager.add(source, SourcePriority.PRIORITY_PART); 2369 _workManager.add(source, SourcePriority.PRIORITY_PART);
2370 } 2370 }
2371 ChangeNoticeImpl notice = _getNotice(source); 2371 ChangeNoticeImpl notice = _getNotice(source);
2372 notice.compilationUnit = unit; 2372 notice.compilationUnit = unit;
2373 notice.resolved = true;
2373 notice.setErrors(dartEntry.allErrors, lineInfo); 2374 notice.setErrors(dartEntry.allErrors, lineInfo);
2374 } 2375 }
2375 } 2376 }
2376 } 2377 }
2377 if (thrownException != null) { 2378 if (thrownException != null) {
2378 throw new AnalysisException('<rethrow>', thrownException); 2379 throw new AnalysisException('<rethrow>', thrownException);
2379 } 2380 }
2380 return unitEntry; 2381 return unitEntry;
2381 } 2382 }
2382 2383
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 dartEntry.recordResolutionErrorInLibrary( 2448 dartEntry.recordResolutionErrorInLibrary(
2448 librarySource, 2449 librarySource,
2449 thrownException); 2450 thrownException);
2450 _cache.remove(source); 2451 _cache.remove(source);
2451 } 2452 }
2452 if (source != librarySource) { 2453 if (source != librarySource) {
2453 _workManager.add(source, SourcePriority.PRIORITY_PART); 2454 _workManager.add(source, SourcePriority.PRIORITY_PART);
2454 } 2455 }
2455 ChangeNoticeImpl notice = _getNotice(source); 2456 ChangeNoticeImpl notice = _getNotice(source);
2456 notice.compilationUnit = unit; 2457 notice.compilationUnit = unit;
2458 notice.resolved = true;
2457 notice.setErrors(dartEntry.allErrors, lineInfo); 2459 notice.setErrors(dartEntry.allErrors, lineInfo);
2458 } 2460 }
2459 } 2461 }
2460 } 2462 }
2461 if (thrownException != null) { 2463 if (thrownException != null) {
2462 throw new AnalysisException('<rethrow>', thrownException); 2464 throw new AnalysisException('<rethrow>', thrownException);
2463 } 2465 }
2464 return unitEntry; 2466 return unitEntry;
2465 } 2467 }
2466 2468
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
4619 * @param task the task that was performed 4621 * @param task the task that was performed
4620 * @return an entry containing the computed results 4622 * @return an entry containing the computed results
4621 * @throws AnalysisException if the results could not be recorded 4623 * @throws AnalysisException if the results could not be recorded
4622 */ 4624 */
4623 DartEntry 4625 DartEntry
4624 _recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task) { 4626 _recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task) {
4625 CompilationUnit unit = task.compilationUnit; 4627 CompilationUnit unit = task.compilationUnit;
4626 if (unit != null) { 4628 if (unit != null) {
4627 ChangeNoticeImpl notice = _getNotice(task.source); 4629 ChangeNoticeImpl notice = _getNotice(task.source);
4628 notice.compilationUnit = unit; 4630 notice.compilationUnit = unit;
4631 notice.resolved = true;
4629 _incrementalAnalysisCache = 4632 _incrementalAnalysisCache =
4630 IncrementalAnalysisCache.cacheResult(task.cache, unit); 4633 IncrementalAnalysisCache.cacheResult(task.cache, unit);
4631 } 4634 }
4632 return null; 4635 return null;
4633 } 4636 }
4634 4637
4635 /** 4638 /**
4636 * Record the results produced by performing a [task] and return the cache 4639 * Record the results produced by performing a [task] and return the cache
4637 * entry associated with the results. 4640 * entry associated with the results.
4638 */ 4641 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4679 partEntry.addContainingLibrary(source); 4682 partEntry.addContainingLibrary(source);
4680 } 4683 }
4681 } 4684 }
4682 dartEntry.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); 4685 dartEntry.setValue(DartEntry.PARSED_UNIT, task.compilationUnit);
4683 dartEntry.setValue(DartEntry.PARSE_ERRORS, task.errors); 4686 dartEntry.setValue(DartEntry.PARSE_ERRORS, task.errors);
4684 dartEntry.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); 4687 dartEntry.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources);
4685 dartEntry.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); 4688 dartEntry.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources);
4686 dartEntry.setValue(DartEntry.INCLUDED_PARTS, newParts); 4689 dartEntry.setValue(DartEntry.INCLUDED_PARTS, newParts);
4687 _cache.storedAst(source); 4690 _cache.storedAst(source);
4688 ChangeNoticeImpl notice = _getNotice(source); 4691 ChangeNoticeImpl notice = _getNotice(source);
4692 if (notice.compilationUnit == null) {
4693 notice.compilationUnit = task.compilationUnit;
4694 notice.resolved = false;
4695 }
4689 notice.setErrors(dartEntry.allErrors, task.lineInfo); 4696 notice.setErrors(dartEntry.allErrors, task.lineInfo);
4690 // Verify that the incrementally parsed and resolved unit in the incremental 4697 // Verify that the incrementally parsed and resolved unit in the incremental
4691 // cache is structurally equivalent to the fully parsed unit 4698 // cache is structurally equivalent to the fully parsed unit
4692 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure( 4699 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(
4693 _incrementalAnalysisCache, 4700 _incrementalAnalysisCache,
4694 source, 4701 source,
4695 task.compilationUnit); 4702 task.compilationUnit);
4696 return dartEntry; 4703 return dartEntry;
4697 } 4704 }
4698 4705
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4757 _cache.removedAst(source); 4764 _cache.removedAst(source);
4758 throw new AnalysisException('<rethrow>', thrownException); 4765 throw new AnalysisException('<rethrow>', thrownException);
4759 } 4766 }
4760 htmlEntry.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED); 4767 htmlEntry.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED);
4761 htmlEntry.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); 4768 htmlEntry.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit);
4762 htmlEntry.setValue(HtmlEntry.ELEMENT, task.element); 4769 htmlEntry.setValue(HtmlEntry.ELEMENT, task.element);
4763 htmlEntry.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); 4770 htmlEntry.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors);
4764 _cache.storedAst(source); 4771 _cache.storedAst(source);
4765 ChangeNoticeImpl notice = _getNotice(source); 4772 ChangeNoticeImpl notice = _getNotice(source);
4766 notice.htmlUnit = task.resolvedUnit; 4773 notice.htmlUnit = task.resolvedUnit;
4774 notice.resolved = true;
4767 LineInfo lineInfo = htmlEntry.getValue(SourceEntry.LINE_INFO); 4775 LineInfo lineInfo = htmlEntry.getValue(SourceEntry.LINE_INFO);
4768 notice.setErrors(htmlEntry.allErrors, lineInfo); 4776 notice.setErrors(htmlEntry.allErrors, lineInfo);
4769 return htmlEntry; 4777 return htmlEntry;
4770 } 4778 }
4771 4779
4772 /** 4780 /**
4773 * Record the results produced by performing a [task] and return the cache 4781 * Record the results produced by performing a [task] and return the cache
4774 * entry associated with the results. 4782 * entry associated with the results.
4775 */ 4783 */
4776 DartEntry _recordScanDartTaskResults(ScanDartTask task) { 4784 DartEntry _recordScanDartTaskResults(ScanDartTask task) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
5054 oldUnit.element.library.source; 5062 oldUnit.element.library.source;
5055 incrementalResolutionValidation_lastUnit = oldUnit; 5063 incrementalResolutionValidation_lastUnit = oldUnit;
5056 return false; 5064 return false;
5057 } 5065 }
5058 // prepare notices 5066 // prepare notices
5059 units.forEach((Source source, CompilationUnit unit) { 5067 units.forEach((Source source, CompilationUnit unit) {
5060 DartEntry dartEntry = _cache.get(source); 5068 DartEntry dartEntry = _cache.get(source);
5061 LineInfo lineInfo = getLineInfo(source); 5069 LineInfo lineInfo = getLineInfo(source);
5062 ChangeNoticeImpl notice = _getNotice(source); 5070 ChangeNoticeImpl notice = _getNotice(source);
5063 notice.compilationUnit = unit; 5071 notice.compilationUnit = unit;
5072 notice.resolved = true;
5064 notice.setErrors(dartEntry.allErrors, lineInfo); 5073 notice.setErrors(dartEntry.allErrors, lineInfo);
5065 }); 5074 });
5066 // OK 5075 // OK
5067 return true; 5076 return true;
5068 } 5077 }
5069 5078
5070 /** 5079 /**
5071 * Check the cache for any invalid entries (entries whose modification time do es not match the 5080 * Check the cache for any invalid entries (entries whose modification time do es not match the
5072 * modification time of the source associated with the entry). Invalid entries will be marked as 5081 * modification time of the source associated with the entry). Invalid entries will be marked as
5073 * invalid so that the source will be re-analyzed. 5082 * invalid so that the source will be re-analyzed.
(...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after
7224 ERROR, 7233 ERROR,
7225 FLUSHED, 7234 FLUSHED,
7226 IN_PROCESS, 7235 IN_PROCESS,
7227 INVALID, 7236 INVALID,
7228 VALID]; 7237 VALID];
7229 7238
7230 const CacheState(String name, int ordinal) : super(name, ordinal); 7239 const CacheState(String name, int ordinal) : super(name, ordinal);
7231 } 7240 }
7232 7241
7233 /** 7242 /**
7234 * The interface `ChangeNotice` defines the behavior of objects that represent a change to the 7243 * An object that represents a change to the analysis results associated with a
7235 * analysis results associated with a given source. 7244 * given source.
7236 */ 7245 */
7237 abstract class ChangeNotice implements AnalysisErrorInfo { 7246 abstract class ChangeNotice implements AnalysisErrorInfo {
7238 /** 7247 /**
7239 * Return the fully resolved AST that changed as a result of the analysis, or `null` if the 7248 * Return the AST that changed as a result of the analysis, or `null` if the
7240 * AST was not changed. 7249 * AST was not changed. Use the getter [resolved] to determine whether the
7241 * 7250 * AST has been fully resolved.
7242 * @return the fully resolved AST that changed as a result of the analysis
7243 */ 7251 */
7244 CompilationUnit get compilationUnit; 7252 CompilationUnit get compilationUnit;
7245 7253
7246 /** 7254 /**
7247 * Return the fully resolved HTML that changed as a result of the analysis, or `null` if the 7255 * Return the HTML that changed as a result of the analysis, or `null` if the
7248 * HTML was not changed. 7256 * HTML was not changed. Use the getter [resolved] to determine whether the
7249 * 7257 * HTML has been fully resolved.
7250 * @return the fully resolved HTML that changed as a result of the analysis
7251 */ 7258 */
7252 ht.HtmlUnit get htmlUnit; 7259 ht.HtmlUnit get htmlUnit;
7253 7260
7254 /** 7261 /**
7262 * Return `true` if the [compilationUnit] or [htmlUnit] (whichever is
7263 * currently set) has been resolved.
7264 */
7265 bool get resolved;
7266
7267 /**
7255 * Return the source for which the result is being reported. 7268 * Return the source for which the result is being reported.
7256 *
7257 * @return the source for which the result is being reported
7258 */ 7269 */
7259 Source get source; 7270 Source get source;
7260 } 7271 }
7261 7272
7262 /** 7273 /**
7263 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis results 7274 * An implementation of a [ChangeNotice].
7264 * associated with a given source.
7265 */ 7275 */
7266 class ChangeNoticeImpl implements ChangeNotice { 7276 class ChangeNoticeImpl implements ChangeNotice {
7267 /** 7277 /**
7268 * An empty list of change notices. 7278 * An empty list of change notices.
7269 */ 7279 */
7270 static const List<ChangeNoticeImpl> EMPTY_ARRAY = const <ChangeNoticeImpl>[]; 7280 static const List<ChangeNoticeImpl> EMPTY_ARRAY = const <ChangeNoticeImpl>[];
7271 7281
7272 /** 7282 /**
7273 * The source for which the result is being reported. 7283 * The source for which the result is being reported.
7274 */ 7284 */
7275 final Source source; 7285 final Source source;
7276 7286
7277 /** 7287 /**
7278 * The fully resolved AST that changed as a result of the analysis, or `null` if the AST was 7288 * The AST that changed as a result of the analysis, or `null` if the AST was
7279 * not changed. 7289 * not changed. Use the getter [resolved] to determine whether the AST has
7290 * been fully resolved.
7280 */ 7291 */
7281 CompilationUnit compilationUnit; 7292 CompilationUnit compilationUnit;
7282 7293
7283 /** 7294 /**
7284 * The fully resolved HTML that changed as a result of the analysis, or `null` if the HTML 7295 * The HTML that changed as a result of the analysis, or `null` if the HTML
7285 * was not changed. 7296 * was not changed. Use the getter [resolved] to determine whether the HTML
7297 * has been fully resolved.
7286 */ 7298 */
7287 ht.HtmlUnit htmlUnit; 7299 ht.HtmlUnit htmlUnit;
7288 7300
7289 /** 7301 /**
7290 * The errors that changed as a result of the analysis, or `null` if errors we re not 7302 * A flag indicating whether the [compilationUnit] or [htmlUnit] (whichever is
7291 * changed. 7303 * currently set) has been resolved.
7304 */
7305 bool resolved = false;
7306
7307 /**
7308 * The errors that changed as a result of the analysis, or `null` if errors
7309 * were not changed.
7292 */ 7310 */
7293 List<AnalysisError> _errors; 7311 List<AnalysisError> _errors;
7294 7312
7295 /** 7313 /**
7296 * The line information associated with the source, or `null` if errors were n ot changed. 7314 * The line information associated with the source, or `null` if errors were
7315 * not changed.
7297 */ 7316 */
7298 LineInfo _lineInfo; 7317 LineInfo _lineInfo;
7299 7318
7300 /** 7319 /**
7301 * Initialize a newly created notice associated with the given source. 7320 * Initialize a newly created notice associated with the given source.
7302 * 7321 *
7303 * @param source the source for which the change is being reported 7322 * @param source the source for which the change is being reported
7304 */ 7323 */
7305 ChangeNoticeImpl(this.source); 7324 ChangeNoticeImpl(this.source);
7306 7325
7307 @override 7326 @override
7308 List<AnalysisError> get errors => _errors; 7327 List<AnalysisError> get errors => _errors;
7309 7328
7310 @override 7329 @override
7311 LineInfo get lineInfo => _lineInfo; 7330 LineInfo get lineInfo => _lineInfo;
7312 7331
7313 /** 7332 /**
7314 * Set the errors that changed as a result of the analysis to the given errors and set the line 7333 * Set the errors that changed as a result of the analysis to the given
7315 * information to the given line information. 7334 * [errors] and set the line information to the given [lineInfo].
7316 *
7317 * @param errors the errors that changed as a result of the analysis
7318 * @param lineInfo the line information associated with the source
7319 */ 7335 */
7320 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { 7336 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) {
7321 this._errors = errors; 7337 this._errors = errors;
7322 this._lineInfo = lineInfo; 7338 this._lineInfo = lineInfo;
7323 if (lineInfo == null) { 7339 if (lineInfo == null) {
7324 AnalysisEngine.instance.logger.logInformation( 7340 AnalysisEngine.instance.logger.logInformation(
7325 "No line info: $source", 7341 "No line info: $source",
7326 new CaughtException(new AnalysisException(), null)); 7342 new CaughtException(new AnalysisException(), null));
7327 } 7343 }
7328 } 7344 }
(...skipping 4919 matching lines...) Expand 10 before | Expand all | Expand 10 after
12248 if (element.id == _id) { 12264 if (element.id == _id) {
12249 result = element; 12265 result = element;
12250 throw new _ElementByIdFinderException(); 12266 throw new _ElementByIdFinderException();
12251 } 12267 }
12252 super.visitElement(element); 12268 super.visitElement(element);
12253 } 12269 }
12254 } 12270 }
12255 12271
12256 class _ElementByIdFinderException { 12272 class _ElementByIdFinderException {
12257 } 12273 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/operation/operation_analysis.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698