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

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

Issue 660203003: Add (an as yet unused) task (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | 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:collection'; 10 import 'dart:collection';
11
12 import 'package:analyzer/src/task/task_dart.dart';
13
11 import 'java_core.dart'; 14 import 'java_core.dart';
12 import 'java_engine.dart'; 15 import 'java_engine.dart';
13 import 'utilities_collection.dart'; 16 import 'utilities_collection.dart';
14 import 'utilities_general.dart'; 17 import 'utilities_general.dart';
15 import 'instrumentation.dart'; 18 import 'instrumentation.dart';
16 import 'error.dart'; 19 import 'error.dart';
17 import 'source.dart'; 20 import 'source.dart';
18 import 'scanner.dart'; 21 import 'scanner.dart';
19 import 'ast.dart'; 22 import 'ast.dart';
20 import 'parser.dart' show Parser, IncrementalParser; 23 import 'parser.dart' show Parser, IncrementalParser;
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 bool _containsAny(List<Source> sources, List<Source> targetSources) { 2474 bool _containsAny(List<Source> sources, List<Source> targetSources) {
2472 for (Source targetSource in targetSources) { 2475 for (Source targetSource in targetSources) {
2473 if (_contains(sources, targetSource)) { 2476 if (_contains(sources, targetSource)) {
2474 return true; 2477 return true;
2475 } 2478 }
2476 } 2479 }
2477 return false; 2480 return false;
2478 } 2481 }
2479 2482
2480 /** 2483 /**
2484 * Create a [BuildUnitElementTask] for the given [source].
2485 */
2486 AnalysisContextImpl_TaskData _createBuildUnitElementTask(Source source, DartEn try dartEntry, Source librarySource) {
2487 CompilationUnit unit = dartEntry.resolvableCompilationUnit;
2488 if (unit == null) {
2489 return _createParseDartTask(source, dartEntry);
2490 }
2491 return new AnalysisContextImpl_TaskData(
2492 new BuildUnitElementTask(this, source, librarySource, unit),
2493 false);
2494 }
2495
2496 /**
2481 * Create a [GenerateDartErrorsTask] for the given source, marking the verific ation errors 2497 * Create a [GenerateDartErrorsTask] for the given source, marking the verific ation errors
2482 * as being in-process. The compilation unit and the library can be the same i f the compilation 2498 * as being in-process. The compilation unit and the library can be the same i f the compilation
2483 * unit is the defining compilation unit of the library. 2499 * unit is the defining compilation unit of the library.
2484 * 2500 *
2485 * @param unitSource the source for the compilation unit to be verified 2501 * @param unitSource the source for the compilation unit to be verified
2486 * @param unitEntry the entry for the compilation unit 2502 * @param unitEntry the entry for the compilation unit
2487 * @param librarySource the source for the library containing the compilation unit 2503 * @param librarySource the source for the library containing the compilation unit
2488 * @param libraryEntry the entry for the library 2504 * @param libraryEntry the entry for the library
2489 * @return task data representing the created task 2505 * @return task data representing the created task
2490 */ 2506 */
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2546 * @param source the source whose content is to be accessed 2562 * @param source the source whose content is to be accessed
2547 * @param sourceEntry the entry for the source 2563 * @param sourceEntry the entry for the source
2548 * @return task data representing the created task 2564 * @return task data representing the created task
2549 */ 2565 */
2550 AnalysisContextImpl_TaskData _createGetContentTask(Source source, SourceEntry sourceEntry) { 2566 AnalysisContextImpl_TaskData _createGetContentTask(Source source, SourceEntry sourceEntry) {
2551 sourceEntry.setState(SourceEntry.CONTENT, CacheState.IN_PROCESS); 2567 sourceEntry.setState(SourceEntry.CONTENT, CacheState.IN_PROCESS);
2552 return new AnalysisContextImpl_TaskData(new GetContentTask(this, source), fa lse); 2568 return new AnalysisContextImpl_TaskData(new GetContentTask(this, source), fa lse);
2553 } 2569 }
2554 2570
2555 /** 2571 /**
2556 * Create a [ParseDartTask] for the given source, marking the parse errors as being 2572 * Create a [ParseDartTask] for the given [source].
2557 * in-process.
2558 *
2559 * @param source the source whose content is to be parsed
2560 * @param dartEntry the entry for the source
2561 * @return task data representing the created task
2562 */ 2573 */
2563 AnalysisContextImpl_TaskData _createParseDartTask(Source source, DartEntry dar tEntry) { 2574 AnalysisContextImpl_TaskData _createParseDartTask(Source source, DartEntry dar tEntry) {
2564 if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID || dartEn try.getState(SourceEntry.LINE_INFO) != CacheState.VALID) { 2575 if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID || dartEn try.getState(SourceEntry.LINE_INFO) != CacheState.VALID) {
2565 return _createScanDartTask(source, dartEntry); 2576 return _createScanDartTask(source, dartEntry);
2566 } 2577 }
2567 Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM); 2578 Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM);
2568 dartEntry.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); 2579 dartEntry.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED);
2569 dartEntry.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); 2580 dartEntry.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
2570 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source, toke nStream, dartEntry.getValue(SourceEntry.LINE_INFO)), false); 2581 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source, toke nStream, dartEntry.getValue(SourceEntry.LINE_INFO)), false);
2571 } 2582 }
2572 2583
2573 /** 2584 /**
2574 * Create a [ParseHtmlTask] for the given source, marking the parse errors as being 2585 * Create a [ParseHtmlTask] for the given [source].
2575 * in-process.
2576 *
2577 * @param source the source whose content is to be parsed
2578 * @param htmlEntry the entry for the source
2579 * @return task data representing the created task
2580 */ 2586 */
2581 AnalysisContextImpl_TaskData _createParseHtmlTask(Source source, HtmlEntry htm lEntry) { 2587 AnalysisContextImpl_TaskData _createParseHtmlTask(Source source, HtmlEntry htm lEntry) {
2582 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { 2588 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) {
2583 return _createGetContentTask(source, htmlEntry); 2589 return _createGetContentTask(source, htmlEntry);
2584 } 2590 }
2585 String content = htmlEntry.getValue(SourceEntry.CONTENT); 2591 String content = htmlEntry.getValue(SourceEntry.CONTENT);
2586 htmlEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); 2592 htmlEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED);
2587 htmlEntry.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS); 2593 htmlEntry.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS);
2588 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source, cont ent), false); 2594 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source, cont ent), false);
2589 } 2595 }
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
3804 // notify about Dart errors 3810 // notify about Dart errors
3805 ChangeNoticeImpl notice = _getNotice(elementSource); 3811 ChangeNoticeImpl notice = _getNotice(elementSource);
3806 notice.setErrors(dartEntry.allErrors, computeLineInfo(elementSource)); 3812 notice.setErrors(dartEntry.allErrors, computeLineInfo(elementSource));
3807 } 3813 }
3808 } 3814 }
3809 // remember Angular entry point 3815 // remember Angular entry point
3810 entry.setValue(HtmlEntry.ANGULAR_ENTRY, application); 3816 entry.setValue(HtmlEntry.ANGULAR_ENTRY, application);
3811 } 3817 }
3812 3818
3813 /** 3819 /**
3820 * Record the results produced by performing a [task] and return the cache
3821 * entry associated with the results.
3822 */
3823 DartEntry _recordBuildUnitElementTask(BuildUnitElementTask task) {
3824 Source source = task.source;
3825 Source library = task.library;
3826 DartEntry dartEntry = _cache.get(source);
3827 CaughtException thrownException = task.exception;
3828 if (thrownException != null) {
3829 dartEntry.recordBuildElementErrorInLibrary(library, thrownException);
3830 throw new AnalysisException('<rethrow>', thrownException);
3831 }
3832 dartEntry.setValueInLibrary(DartEntry.BUILT_UNIT, library, task.unit);
3833 dartEntry.setValueInLibrary(DartEntry.BUILT_ELEMENT, library, task.unitEleme nt);
3834 ChangeNoticeImpl notice = _getNotice(source);
3835 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO);
3836 notice.setErrors(dartEntry.allErrors, lineInfo);
3837 return dartEntry;
3838 }
3839
3840 /**
3814 * Given a cache entry and a library element, record the library element and o ther information 3841 * Given a cache entry and a library element, record the library element and o ther information
3815 * gleaned from the element in the cache entry. 3842 * gleaned from the element in the cache entry.
3816 * 3843 *
3817 * @param dartCopy the cache entry in which data is to be recorded 3844 * @param dartCopy the cache entry in which data is to be recorded
3818 * @param library the library element used to record information 3845 * @param library the library element used to record information
3819 * @param librarySource the source for the library used to record information 3846 * @param librarySource the source for the library used to record information
3820 * @param htmlSource the source for the HTML library 3847 * @param htmlSource the source for the HTML library
3821 */ 3848 */
3822 void _recordElementData(DartEntry dartEntry, LibraryElement library, Source li brarySource, Source htmlSource) { 3849 void _recordElementData(DartEntry dartEntry, LibraryElement library, Source li brarySource, Source htmlSource) {
3823 dartEntry.setValue(DartEntry.ELEMENT, library); 3850 dartEntry.setValue(DartEntry.ELEMENT, library);
(...skipping 10 matching lines...) Expand all
3834 DartEntry dartEntry = _cache.get(source); 3861 DartEntry dartEntry = _cache.get(source);
3835 Source librarySource = task.libraryElement.source; 3862 Source librarySource = task.libraryElement.source;
3836 CaughtException thrownException = task.exception; 3863 CaughtException thrownException = task.exception;
3837 if (thrownException != null) { 3864 if (thrownException != null) {
3838 dartEntry.recordVerificationErrorInLibrary(librarySource, thrownException) ; 3865 dartEntry.recordVerificationErrorInLibrary(librarySource, thrownException) ;
3839 throw new AnalysisException('<rethrow>', thrownException); 3866 throw new AnalysisException('<rethrow>', thrownException);
3840 } 3867 }
3841 dartEntry.setValueInLibrary( 3868 dartEntry.setValueInLibrary(
3842 DartEntry.VERIFICATION_ERRORS, 3869 DartEntry.VERIFICATION_ERRORS,
3843 librarySource, 3870 librarySource,
3844 task.errors); 3871 task.errors);
3845 ChangeNoticeImpl notice = _getNotice(source); 3872 ChangeNoticeImpl notice = _getNotice(source);
3846 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO); 3873 LineInfo lineInfo = dartEntry.getValue(SourceEntry.LINE_INFO);
3847 notice.setErrors(dartEntry.allErrors, lineInfo); 3874 notice.setErrors(dartEntry.allErrors, lineInfo);
3848 return dartEntry; 3875 return dartEntry;
3849 } 3876 }
3850 3877
3851 /** 3878 /**
3852 * Record the results produced by performing a [task] and return the cache 3879 * Record the results produced by performing a [task] and return the cache
3853 * entry associated with the results. 3880 * entry associated with the results.
3854 */ 3881 */
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
4404 writer.print(" "); 4431 writer.print(" ");
4405 writer.println(source.fullName); 4432 writer.println(source.fullName);
4406 } 4433 }
4407 _logInformation(writer.toString()); 4434 _logInformation(writer.toString());
4408 } 4435 }
4409 return changedSources.length > 0; 4436 return changedSources.length > 0;
4410 } 4437 }
4411 } 4438 }
4412 4439
4413 /** 4440 /**
4414 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c ontext to 4441 * An `AnalysisTaskResultRecorder` is used by an analysis context to record the
4415 * record the results of a task. 4442 * results of a task.
4416 */ 4443 */
4417 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi tor<SourceEntry> { 4444 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi tor<SourceEntry> {
4418 final AnalysisContextImpl AnalysisContextImpl_this; 4445 final AnalysisContextImpl AnalysisContextImpl_this;
4419 4446
4420 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this); 4447 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this);
4421 4448
4422 @override 4449 @override
4423 DartEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => Analysis ContextImpl_this._recordGenerateDartErrorsTask(task); 4450 DartEntry visitBuildUnitElementTask(BuildUnitElementTask task)
4451 => AnalysisContextImpl_this._recordBuildUnitElementTask(task);
4424 4452
4425 @override 4453 @override
4426 DartEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => AnalysisCo ntextImpl_this._recordGenerateDartHintsTask(task); 4454 DartEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task)
4455 => AnalysisContextImpl_this._recordGenerateDartErrorsTask(task);
4427 4456
4428 @override 4457 @override
4429 SourceEntry visitGetContentTask(GetContentTask task) => AnalysisContextImpl_th is._recordGetContentsTask(task); 4458 DartEntry visitGenerateDartHintsTask(GenerateDartHintsTask task)
4459 => AnalysisContextImpl_this._recordGenerateDartHintsTask(task);
4430 4460
4431 @override 4461 @override
4432 DartEntry visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => Analys isContextImpl_this._recordIncrementalAnalysisTaskResults(task); 4462 SourceEntry visitGetContentTask(GetContentTask task)
4463 => AnalysisContextImpl_this._recordGetContentsTask(task);
4433 4464
4434 @override 4465 @override
4435 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this._ recordParseDartTaskResults(task); 4466 DartEntry visitIncrementalAnalysisTask(IncrementalAnalysisTask task)
4467 => AnalysisContextImpl_this._recordIncrementalAnalysisTaskResults(task);
4436 4468
4437 @override 4469 @override
4438 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this._ recordParseHtmlTaskResults(task); 4470 DartEntry visitParseDartTask(ParseDartTask task)
4471 => AnalysisContextImpl_this._recordParseDartTaskResults(task);
4439 4472
4440 @override 4473 @override
4441 HtmlEntry visitPolymerBuildHtmlTask(PolymerBuildHtmlTask task) => AnalysisCont extImpl_this._recordPolymerBuildHtmlTaskResults(task); 4474 HtmlEntry visitParseHtmlTask(ParseHtmlTask task)
4475 => AnalysisContextImpl_this._recordParseHtmlTaskResults(task);
4442 4476
4443 @override 4477 @override
4444 HtmlEntry visitPolymerResolveHtmlTask(PolymerResolveHtmlTask task) => Analysis ContextImpl_this._recordPolymerResolveHtmlTaskResults(task); 4478 HtmlEntry visitPolymerBuildHtmlTask(PolymerBuildHtmlTask task)
4479 => AnalysisContextImpl_this._recordPolymerBuildHtmlTaskResults(task);
4445 4480
4446 @override 4481 @override
4447 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp lateTask task) => AnalysisContextImpl_this._recordResolveAngularComponentTemplat eTaskResults(task); 4482 HtmlEntry visitPolymerResolveHtmlTask(PolymerResolveHtmlTask task)
4483 => AnalysisContextImpl_this._recordPolymerResolveHtmlTaskResults(task);
4448 4484
4449 @override 4485 @override
4450 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) = > AnalysisContextImpl_this._recordResolveAngularEntryHtmlTaskResults(task); 4486 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp lateTask task)
4487 => AnalysisContextImpl_this._recordResolveAngularComponentTemplateTaskResu lts(task);
4451 4488
4452 @override 4489 @override
4453 DartEntry visitResolveDartLibraryCycleTask(ResolveDartLibraryCycleTask task) = > AnalysisContextImpl_this.recordResolveDartLibraryCycleTaskResults(task); 4490 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task)
4491 => AnalysisContextImpl_this._recordResolveAngularEntryHtmlTaskResults(task );
4454 4492
4455 @override 4493 @override
4456 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis ContextImpl_this.recordResolveDartLibraryTaskResults(task); 4494 DartEntry visitResolveDartLibraryCycleTask(ResolveDartLibraryCycleTask task)
4495 => AnalysisContextImpl_this.recordResolveDartLibraryCycleTaskResults(task) ;
4457 4496
4458 @override 4497 @override
4459 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContex tImpl_this._recordResolveDartUnitTaskResults(task); 4498 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task)
4499 => AnalysisContextImpl_this.recordResolveDartLibraryTaskResults(task);
4460 4500
4461 @override 4501 @override
4462 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_th is._recordResolveHtmlTaskResults(task); 4502 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task)
4503 => AnalysisContextImpl_this._recordResolveDartUnitTaskResults(task);
4463 4504
4464 @override 4505 @override
4465 DartEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this._re cordScanDartTaskResults(task); 4506 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task)
4507 => AnalysisContextImpl_this._recordResolveHtmlTaskResults(task);
4508
4509 @override
4510 DartEntry visitScanDartTask(ScanDartTask task)
4511 => AnalysisContextImpl_this._recordScanDartTaskResults(task);
4466 } 4512 }
4467 4513
4468 class AnalysisContextImpl_ContextRetentionPolicy implements CacheRetentionPolicy { 4514 class AnalysisContextImpl_ContextRetentionPolicy implements CacheRetentionPolicy {
4469 final AnalysisContextImpl AnalysisContextImpl_this; 4515 final AnalysisContextImpl AnalysisContextImpl_this;
4470 4516
4471 AnalysisContextImpl_ContextRetentionPolicy(this.AnalysisContextImpl_this); 4517 AnalysisContextImpl_ContextRetentionPolicy(this.AnalysisContextImpl_this);
4472 4518
4473 @override 4519 @override
4474 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) { 4520 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) {
4475 int priorityCount = AnalysisContextImpl_this._priorityOrder.length; 4521 int priorityCount = AnalysisContextImpl_this._priorityOrder.length;
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
5930 internalPerform(); 5976 internalPerform();
5931 } on AnalysisException catch (exception) { 5977 } on AnalysisException catch (exception) {
5932 throw exception; 5978 throw exception;
5933 } catch (exception, stackTrace) { 5979 } catch (exception, stackTrace) {
5934 throw new AnalysisException(exception.toString(), new CaughtException(exce ption, stackTrace)); 5980 throw new AnalysisException(exception.toString(), new CaughtException(exce ption, stackTrace));
5935 } 5981 }
5936 } 5982 }
5937 } 5983 }
5938 5984
5939 /** 5985 /**
5940 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can visit tasks. 5986 * An `AnalysisTaskVisitor` visits tasks. While tasks are not structured in any
5941 * While tasks are not structured in any interesting way, this class provides th e ability to 5987 * interesting way, this class provides the ability to dispatch to an
5942 * dispatch to an appropriate method. 5988 * appropriate method.
5943 */ 5989 */
5944 abstract class AnalysisTaskVisitor<E> { 5990 abstract class AnalysisTaskVisitor<E> {
5945 /** 5991 /**
5946 * Visit a [GenerateDartErrorsTask]. 5992 * Visit the given [task], returning the result of the visit. This method will
5947 * 5993 * throw an AnalysisException if the visitor throws an exception.
5948 * @param task the task to be visited 5994 */
5949 * @return the result of visiting the task 5995 E visitBuildUnitElementTask(BuildUnitElementTask task);
5950 * @throws AnalysisException if the visitor throws an exception for some reaso n 5996
5997 /**
5998 * Visit the given [task], returning the result of the visit. This method will
5999 * throw an AnalysisException if the visitor throws an exception.
5951 */ 6000 */
5952 E visitGenerateDartErrorsTask(GenerateDartErrorsTask task); 6001 E visitGenerateDartErrorsTask(GenerateDartErrorsTask task);
5953 6002
5954 /** 6003 /**
5955 * Visit a [GenerateDartHintsTask]. 6004 * Visit the given [task], returning the result of the visit. This method will
5956 * 6005 * throw an AnalysisException if the visitor throws an exception.
5957 * @param task the task to be visited
5958 * @return the result of visiting the task
5959 * @throws AnalysisException if the visitor throws an exception for some reaso n
5960 */ 6006 */
5961 E visitGenerateDartHintsTask(GenerateDartHintsTask task); 6007 E visitGenerateDartHintsTask(GenerateDartHintsTask task);
5962 6008
5963 /** 6009 /**
5964 * Visit a [GetContentTask]. 6010 * Visit the given [task], returning the result of the visit. This method will
5965 * 6011 * throw an AnalysisException if the visitor throws an exception.
5966 * @param task the task to be visited
5967 * @return the result of visiting the task
5968 * @throws AnalysisException if the visitor throws an exception for some reaso n
5969 */ 6012 */
5970 E visitGetContentTask(GetContentTask task); 6013 E visitGetContentTask(GetContentTask task);
5971 6014
5972 /** 6015 /**
5973 * Visit an [IncrementalAnalysisTask]. 6016 * Visit the given [task], returning the result of the visit. This method will
5974 * 6017 * throw an AnalysisException if the visitor throws an exception.
5975 * @param task the task to be visited
5976 * @return the result of visiting the task
5977 * @throws AnalysisException if the visitor throws an exception for some reaso n
5978 */ 6018 */
5979 E visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTask ); 6019 E visitIncrementalAnalysisTask(IncrementalAnalysisTask incrementalAnalysisTask );
5980 6020
5981 /** 6021 /**
5982 * Visit a [ParseDartTask]. 6022 * Visit the given [task], returning the result of the visit. This method will
5983 * 6023 * throw an AnalysisException if the visitor throws an exception.
5984 * @param task the task to be visited
5985 * @return the result of visiting the task
5986 * @throws AnalysisException if the visitor throws an exception for some reaso n
5987 */ 6024 */
5988 E visitParseDartTask(ParseDartTask task); 6025 E visitParseDartTask(ParseDartTask task);
5989 6026
5990 /** 6027 /**
5991 * Visit a [ParseHtmlTask]. 6028 * Visit the given [task], returning the result of the visit. This method will
5992 * 6029 * throw an AnalysisException if the visitor throws an exception.
5993 * @param task the task to be visited
5994 * @return the result of visiting the task
5995 * @throws AnalysisException if the visitor throws an exception for some reaso n
5996 */ 6030 */
5997 E visitParseHtmlTask(ParseHtmlTask task); 6031 E visitParseHtmlTask(ParseHtmlTask task);
5998 6032
5999 /** 6033 /**
6000 * Visit a [PolymerBuildHtmlTask]. 6034 * Visit the given [task], returning the result of the visit. This method will
6001 * 6035 * throw an AnalysisException if the visitor throws an exception.
6002 * @param task the task to be visited
6003 * @return the result of visiting the task
6004 * @throws AnalysisException if the visitor throws an exception for some reaso n
6005 */ 6036 */
6006 E visitPolymerBuildHtmlTask(PolymerBuildHtmlTask task); 6037 E visitPolymerBuildHtmlTask(PolymerBuildHtmlTask task);
6007 6038
6008 /** 6039 /**
6009 * Visit a [PolymerResolveHtmlTask]. 6040 * Visit the given [task], returning the result of the visit. This method will
6010 * 6041 * throw an AnalysisException if the visitor throws an exception.
6011 * @param task the task to be visited
6012 * @return the result of visiting the task
6013 * @throws AnalysisException if the visitor throws an exception for some reaso n
6014 */ 6042 */
6015 E visitPolymerResolveHtmlTask(PolymerResolveHtmlTask task); 6043 E visitPolymerResolveHtmlTask(PolymerResolveHtmlTask task);
6016 6044
6017 /** 6045 /**
6018 * Visit a [ResolveAngularComponentTemplateTask]. 6046 * Visit the given [task], returning the result of the visit. This method will
6019 * 6047 * throw an AnalysisException if the visitor throws an exception.
6020 * @param task the task to be visited
6021 * @return the result of visiting the task
6022 * @throws AnalysisException if the visitor throws an exception for some reaso n
6023 */ 6048 */
6024 E visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemplateTask task); 6049 E visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemplateTask task);
6025 6050
6026 /** 6051 /**
6027 * Visit a [ResolveAngularEntryHtmlTask]. 6052 * Visit the given [task], returning the result of the visit. This method will
6028 * 6053 * throw an AnalysisException if the visitor throws an exception.
6029 * @param task the task to be visited
6030 * @return the result of visiting the task
6031 * @throws AnalysisException if the visitor throws an exception for some reaso n
6032 */ 6054 */
6033 E visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task); 6055 E visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task);
6034 6056
6035 /** 6057 /**
6036 * Visit a [ResolveDartLibraryCycleTask]. 6058 * Visit the given [task], returning the result of the visit. This method will
6037 * 6059 * throw an AnalysisException if the visitor throws an exception.
6038 * @param task the task to be visited
6039 * @return the result of visiting the task
6040 * @throws AnalysisException if the visitor throws an exception for some reaso n
6041 */ 6060 */
6042 E visitResolveDartLibraryCycleTask(ResolveDartLibraryCycleTask task); 6061 E visitResolveDartLibraryCycleTask(ResolveDartLibraryCycleTask task);
6043 6062
6044 /** 6063 /**
6045 * Visit a [ResolveDartLibraryTask]. 6064 * Visit the given [task], returning the result of the visit. This method will
6046 * 6065 * throw an AnalysisException if the visitor throws an exception.
6047 * @param task the task to be visited
6048 * @return the result of visiting the task
6049 * @throws AnalysisException if the visitor throws an exception for some reaso n
6050 */ 6066 */
6051 E visitResolveDartLibraryTask(ResolveDartLibraryTask task); 6067 E visitResolveDartLibraryTask(ResolveDartLibraryTask task);
6052 6068
6053 /** 6069 /**
6054 * Visit a [ResolveDartUnitTask]. 6070 * Visit the given [task], returning the result of the visit. This method will
6055 * 6071 * throw an AnalysisException if the visitor throws an exception.
6056 * @param task the task to be visited
6057 * @return the result of visiting the task
6058 * @throws AnalysisException if the visitor throws an exception for some reaso n
6059 */ 6072 */
6060 E visitResolveDartUnitTask(ResolveDartUnitTask task); 6073 E visitResolveDartUnitTask(ResolveDartUnitTask task);
6061 6074
6062 /** 6075 /**
6063 * Visit a [ResolveHtmlTask]. 6076 * Visit the given [task], returning the result of the visit. This method will
6064 * 6077 * throw an AnalysisException if the visitor throws an exception.
6065 * @param task the task to be visited
6066 * @return the result of visiting the task
6067 * @throws AnalysisException if the visitor throws an exception for some reaso n
6068 */ 6078 */
6069 E visitResolveHtmlTask(ResolveHtmlTask task); 6079 E visitResolveHtmlTask(ResolveHtmlTask task);
6070 6080
6071 /** 6081 /**
6072 * Visit a [ScanDartTask]. 6082 * Visit the given [task], returning the result of the visit. This method will
6073 * 6083 * throw an AnalysisException if the visitor throws an exception.
6074 * @param task the task to be visited
6075 * @return the result of visiting the task
6076 * @throws AnalysisException if the visitor throws an exception for some reaso n
6077 */ 6084 */
6078 E visitScanDartTask(ScanDartTask task); 6085 E visitScanDartTask(ScanDartTask task);
6079 } 6086 }
6080 6087
6081 /** 6088 /**
6082 * An [Expression] with optional [AngularFormatterNode]s. 6089 * An [Expression] with optional [AngularFormatterNode]s.
6083 */ 6090 */
6084 class AngularExpression { 6091 class AngularExpression {
6085 /** 6092 /**
6086 * The [Expression] to apply formatters to. 6093 * The [Expression] to apply formatters to.
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
7767 = new ResolutionState(); 7774 = new ResolutionState();
7768 7775
7769 /** 7776 /**
7770 * The data descriptor representing the errors reported during Angular 7777 * The data descriptor representing the errors reported during Angular
7771 * resolution. 7778 * resolution.
7772 */ 7779 */
7773 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS 7780 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS
7774 = new DataDescriptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS", Anal ysisError.NO_ERRORS); 7781 = new DataDescriptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS", Anal ysisError.NO_ERRORS);
7775 7782
7776 /** 7783 /**
7777 * The data descriptor representing the errors resulting from building the 7784 * The data descriptor representing the element model representing a single
7778 * element model. 7785 * compilation unit. This model is incomplete and should not be used except as
7786 * input to another task.
7779 */ 7787 */
7780 static final DataDescriptor<List<AnalysisError>> BUILD_ELEMENT_ERRORS 7788 static final DataDescriptor<List<AnalysisError>> BUILT_ELEMENT
7781 = new DataDescriptor<List<AnalysisError>>("DartEntry.BUILD_ELEMENT_ERRORS" , AnalysisError.NO_ERRORS); 7789 = new DataDescriptor<List<AnalysisError>>("DartEntry.BUILT_ELEMENT");
7782 7790
7783 /** 7791 /**
7784 * The data descriptor representing the AST structure after the element model 7792 * The data descriptor representing the AST structure after the element model
7785 * has been built (and declarations are resolved) but before other resolution 7793 * has been built (and declarations are resolved) but before other resolution
7786 * has been performed. 7794 * has been performed.
7787 */ 7795 */
7788 static final DataDescriptor<CompilationUnit> BUILT_UNIT 7796 static final DataDescriptor<CompilationUnit> BUILT_UNIT
7789 = new DataDescriptor<CompilationUnit>("DartEntry.BUILT_UNIT"); 7797 = new DataDescriptor<CompilationUnit>("DartEntry.BUILT_UNIT");
7790 7798
7791 /** 7799 /**
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
7929 /** 7937 /**
7930 * Return all of the errors associated with the compilation unit that are 7938 * Return all of the errors associated with the compilation unit that are
7931 * currently cached. 7939 * currently cached.
7932 */ 7940 */
7933 List<AnalysisError> get allErrors { 7941 List<AnalysisError> get allErrors {
7934 List<AnalysisError> errors = new List<AnalysisError>(); 7942 List<AnalysisError> errors = new List<AnalysisError>();
7935 errors.addAll(getValue(SCAN_ERRORS)); 7943 errors.addAll(getValue(SCAN_ERRORS));
7936 errors.addAll(getValue(PARSE_ERRORS)); 7944 errors.addAll(getValue(PARSE_ERRORS));
7937 ResolutionState state = _resolutionState; 7945 ResolutionState state = _resolutionState;
7938 while (state != null) { 7946 while (state != null) {
7939 errors.addAll(state.getValue(BUILD_ELEMENT_ERRORS));
7940 errors.addAll(state.getValue(RESOLUTION_ERRORS)); 7947 errors.addAll(state.getValue(RESOLUTION_ERRORS));
7941 errors.addAll(state.getValue(VERIFICATION_ERRORS)); 7948 errors.addAll(state.getValue(VERIFICATION_ERRORS));
7942 errors.addAll(state.getValue(HINTS)); 7949 errors.addAll(state.getValue(HINTS));
7943 state = state._nextState; 7950 state = state._nextState;
7944 } 7951 }
7945 errors.addAll(getValue(ANGULAR_ERRORS)); 7952 errors.addAll(getValue(ANGULAR_ERRORS));
7946 if (errors.length == 0) { 7953 if (errors.length == 0) {
7947 return AnalysisError.NO_ERRORS; 7954 return AnalysisError.NO_ERRORS;
7948 } 7955 }
7949 return new List.from(errors); 7956 return new List.from(errors);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
8155 if (resolvedState != CacheState.VALID 8162 if (resolvedState != CacheState.VALID
8156 && resolvedState != CacheState.FLUSHED) { 8163 && resolvedState != CacheState.FLUSHED) {
8157 return false; 8164 return false;
8158 } 8165 }
8159 state = state._nextState; 8166 state = state._nextState;
8160 } 8167 }
8161 return true; 8168 return true;
8162 } 8169 }
8163 8170
8164 /** 8171 /**
8165 * Record that an error occurred while attempting to build the element model 8172 * Record that an [exception] occurred while attempting to build the element
8166 * for the source represented by this entry. This will set the state of all 8173 * model for the source represented by this entry in the context of the given
8167 * resolution-based information as being in error, but will not change the 8174 * [library]. This will set the state of all resolution-based information as
8168 * state of any parse results. 8175 * being in error, but will not change the state of any parse results.
8169 *
8170 * @param librarySource the source of the library in which the element model w as being built
8171 * @param exception the exception that shows where the error occurred
8172 */ 8176 */
8173 void recordBuildElementErrorInLibrary(Source librarySource, CaughtException ex ception) { 8177 void recordBuildElementErrorInLibrary(Source librarySource, CaughtException ex ception) {
8174 this.exception = exception; 8178 setStateInLibrary(BUILT_ELEMENT, librarySource, CacheState.ERROR);
8175 setState(ELEMENT, CacheState.ERROR); 8179 setStateInLibrary(BUILT_UNIT, librarySource, CacheState.ERROR);
8176 setState(IS_LAUNCHABLE, CacheState.ERROR); 8180 recordResolutionErrorInLibrary(librarySource, exception);
8177 setState(IS_CLIENT, CacheState.ERROR);
8178 ResolutionState state = _getOrCreateResolutionState(librarySource);
8179 state.recordBuildElementError();
8180 } 8181 }
8181 8182
8182 @override 8183 @override
8183 void recordContentError(CaughtException exception) { 8184 void recordContentError(CaughtException exception) {
8184 super.recordContentError(exception); 8185 super.recordContentError(exception);
8185 recordScanError(exception); 8186 recordScanError(exception);
8186 } 8187 }
8187 8188
8188 /** 8189 /**
8189 * Record that an error occurred while attempting to generate hints for the 8190 * Record that an error occurred while attempting to generate hints for the
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
8518 || descriptor == SOURCE_KIND 8519 || descriptor == SOURCE_KIND
8519 || descriptor == TOKEN_STREAM 8520 || descriptor == TOKEN_STREAM
8520 || super._isValidDescriptor(descriptor); 8521 || super._isValidDescriptor(descriptor);
8521 } 8522 }
8522 8523
8523 /** 8524 /**
8524 * Return `true` if the [descriptor] is valid for this entry when the data is 8525 * Return `true` if the [descriptor] is valid for this entry when the data is
8525 * relative to a library. 8526 * relative to a library.
8526 */ 8527 */
8527 bool _isValidLibraryDescriptor(DataDescriptor descriptor) { 8528 bool _isValidLibraryDescriptor(DataDescriptor descriptor) {
8528 return descriptor == BUILD_ELEMENT_ERRORS 8529 return descriptor == BUILT_ELEMENT
8529 || descriptor == BUILT_UNIT 8530 || descriptor == BUILT_UNIT
8530 || descriptor == HINTS 8531 || descriptor == HINTS
8531 || descriptor == RESOLUTION_ERRORS 8532 || descriptor == RESOLUTION_ERRORS
8532 || descriptor == RESOLVED_UNIT 8533 || descriptor == RESOLVED_UNIT
8533 || descriptor == VERIFICATION_ERRORS; 8534 || descriptor == VERIFICATION_ERRORS;
8534 } 8535 }
8535 8536
8536 /** 8537 /**
8537 * Given that the specified flag is being transitioned to the given state, set the value of the 8538 * Given that the specified flag is being transitioned to the given state, set the value of the
8538 * flag to the value that should be kept in the cache. 8539 * flag to the value that should be kept in the cache.
(...skipping 3416 matching lines...) Expand 10 before | Expand all | Expand 10 after
11955 } 11956 }
11956 return false; 11957 return false;
11957 } 11958 }
11958 11959
11959 /** 11960 /**
11960 * Invalidate all of the resolution information associated with the compilatio n unit. 11961 * Invalidate all of the resolution information associated with the compilatio n unit.
11961 */ 11962 */
11962 void invalidateAllResolutionInformation() { 11963 void invalidateAllResolutionInformation() {
11963 _nextState = null; 11964 _nextState = null;
11964 _librarySource = null; 11965 _librarySource = null;
11965 setState(DartEntry.BUILT_UNIT, CacheState.INVALID);
11966 setState(DartEntry.BUILD_ELEMENT_ERRORS, CacheState.INVALID);
11967 setState(DartEntry.RESOLVED_UNIT, CacheState.INVALID); 11966 setState(DartEntry.RESOLVED_UNIT, CacheState.INVALID);
11968 setState(DartEntry.RESOLUTION_ERRORS, CacheState.INVALID); 11967 setState(DartEntry.RESOLUTION_ERRORS, CacheState.INVALID);
11969 setState(DartEntry.VERIFICATION_ERRORS, CacheState.INVALID); 11968 setState(DartEntry.VERIFICATION_ERRORS, CacheState.INVALID);
11970 setState(DartEntry.HINTS, CacheState.INVALID); 11969 setState(DartEntry.HINTS, CacheState.INVALID);
11971 } 11970 }
11972 11971
11973 /** 11972 /**
11974 * Record that an error occurred while attempting to build the element model f or the source 11973 * Record that an exception occurred while attempting to build the element
11975 * represented by this state. 11974 * model for the source associated with this state.
11976 */ 11975 */
11977 void recordBuildElementError() { 11976 void recordBuildElementError() {
11978 setState(DartEntry.BUILT_UNIT, CacheState.ERROR); 11977 setState(DartEntry.BUILT_UNIT, CacheState.ERROR);
11979 setState(DartEntry.BUILD_ELEMENT_ERRORS, CacheState.ERROR); 11978 setState(DartEntry.BUILT_ELEMENT, CacheState.ERROR);
11980 recordResolutionError(); 11979 recordResolutionError();
11981 } 11980 }
11982 11981
11983 /** 11982 /**
11984 * Record that an error occurred while attempting to generate hints for the so urce represented 11983 * Record that an exception occurred while attempting to generate hints for
11985 * by this entry. This will set the state of all verification information as b eing in error. 11984 * the source associated with this entry. This will set the state of all
11985 * verification information as being in error.
11986 */ 11986 */
11987 void recordHintError() { 11987 void recordHintError() {
11988 setState(DartEntry.HINTS, CacheState.ERROR); 11988 setState(DartEntry.HINTS, CacheState.ERROR);
11989 } 11989 }
11990 11990
11991 /** 11991 /**
11992 * Record that an error occurred while attempting to resolve the source repres ented by this 11992 * Record that an exception occurred while attempting to resolve the source
11993 * state. 11993 * associated with this state.
11994 */ 11994 */
11995 void recordResolutionError() { 11995 void recordResolutionError() {
11996 setState(DartEntry.RESOLVED_UNIT, CacheState.ERROR); 11996 setState(DartEntry.RESOLVED_UNIT, CacheState.ERROR);
11997 setState(DartEntry.RESOLUTION_ERRORS, CacheState.ERROR); 11997 setState(DartEntry.RESOLUTION_ERRORS, CacheState.ERROR);
11998 recordVerificationError(); 11998 recordVerificationError();
11999 } 11999 }
12000 12000
12001 /** 12001 /**
12002 * Record that an error occurred while attempting to scan or parse the entry r epresented by this 12002 * Record that an exception occurred while attempting to scan or parse the
12003 * entry. This will set the state of all resolution-based information as being in error, but 12003 * source associated with this entry. This will set the state of all
12004 * will not change the state of any parse results. 12004 * resolution-based information as being in error.
12005 */ 12005 */
12006 void recordResolutionErrorsInAllLibraries() { 12006 void recordResolutionErrorsInAllLibraries() {
12007 recordBuildElementError(); 12007 recordBuildElementError();
12008 if (_nextState != null) { 12008 if (_nextState != null) {
12009 _nextState.recordResolutionErrorsInAllLibraries(); 12009 _nextState.recordResolutionErrorsInAllLibraries();
12010 } 12010 }
12011 } 12011 }
12012 12012
12013 /** 12013 /**
12014 * Record that an error occurred while attempting to generate errors and warni ngs for the source 12014 * Record that an exception occurred while attempting to generate errors and
12015 * represented by this entry. This will set the state of all verification info rmation as being 12015 * warnings for the source associated with this entry. This will set the state
12016 * in error. 12016 * of all verification information as being in error.
12017 */ 12017 */
12018 void recordVerificationError() { 12018 void recordVerificationError() {
12019 setState(DartEntry.VERIFICATION_ERRORS, CacheState.ERROR); 12019 setState(DartEntry.VERIFICATION_ERRORS, CacheState.ERROR);
12020 recordHintError(); 12020 recordHintError();
12021 } 12021 }
12022 12022
12023 /** 12023 /**
12024 * Set the state of the data represented by the given [descriptor] to the 12024 * Set the state of the data represented by the given [descriptor] to the
12025 * given [state]. 12025 * given [state].
12026 */ 12026 */
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
12085 } 12085 }
12086 12086
12087 /** 12087 /**
12088 * Write a textual representation of this state to the given builder. The resu lt will only be 12088 * Write a textual representation of this state to the given builder. The resu lt will only be
12089 * used for debugging purposes. 12089 * used for debugging purposes.
12090 * 12090 *
12091 * @param builder the builder to which the text should be written 12091 * @param builder the builder to which the text should be written
12092 */ 12092 */
12093 void _writeOn(StringBuffer buffer) { 12093 void _writeOn(StringBuffer buffer) {
12094 if (_librarySource != null) { 12094 if (_librarySource != null) {
12095 _writeStateOn(buffer, "builtElement", DartEntry.BUILT_ELEMENT);
12095 _writeStateOn(buffer, "builtUnit", DartEntry.BUILT_UNIT); 12096 _writeStateOn(buffer, "builtUnit", DartEntry.BUILT_UNIT);
12096 _writeStateOn(buffer, "buildElementErrors", DartEntry.BUILD_ELEMENT_ERRORS );
12097 _writeStateOn(buffer, "resolvedUnit", DartEntry.RESOLVED_UNIT); 12097 _writeStateOn(buffer, "resolvedUnit", DartEntry.RESOLVED_UNIT);
12098 _writeStateOn(buffer, "resolutionErrors", DartEntry.RESOLUTION_ERRORS); 12098 _writeStateOn(buffer, "resolutionErrors", DartEntry.RESOLUTION_ERRORS);
12099 _writeStateOn(buffer, "verificationErrors", DartEntry.VERIFICATION_ERRORS) ; 12099 _writeStateOn(buffer, "verificationErrors", DartEntry.VERIFICATION_ERRORS) ;
12100 _writeStateOn(buffer, "hints", DartEntry.HINTS); 12100 _writeStateOn(buffer, "hints", DartEntry.HINTS);
12101 if (_nextState != null) { 12101 if (_nextState != null) {
12102 _nextState._writeOn(buffer); 12102 _nextState._writeOn(buffer);
12103 } 12103 }
12104 } 12104 }
12105 } 12105 }
12106 12106
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
13480 _index++; 13480 _index++;
13481 if (_index >= _manager._workQueues[_queueIndex].length) { 13481 if (_index >= _manager._workQueues[_queueIndex].length) {
13482 _index = 0; 13482 _index = 0;
13483 _queueIndex++; 13483 _queueIndex++;
13484 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { 13484 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) {
13485 _queueIndex++; 13485 _queueIndex++;
13486 } 13486 }
13487 } 13487 }
13488 } 13488 }
13489 } 13489 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698