| OLD | NEW |
| 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.src.task.dart; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 import 'package:analyzer/task/general.dart'; | 42 import 'package:analyzer/task/general.dart'; |
| 43 import 'package:analyzer/task/model.dart'; | 43 import 'package:analyzer/task/model.dart'; |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * The [ResultCachingPolicy] for ASTs. | 46 * The [ResultCachingPolicy] for ASTs. |
| 47 */ | 47 */ |
| 48 const ResultCachingPolicy<CompilationUnit> AST_CACHING_POLICY = | 48 const ResultCachingPolicy<CompilationUnit> AST_CACHING_POLICY = |
| 49 const SimpleResultCachingPolicy(16384, 16384); | 49 const SimpleResultCachingPolicy(16384, 16384); |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * The [ResultCachingPolicy] for lists of [ConstantEvaluationTarget]s. |
| 53 */ |
| 54 const ResultCachingPolicy<List<ConstantEvaluationTarget>> |
| 55 CONSTANT_EVALUATION_TARGET_LIST_POLICY = |
| 56 const SimpleResultCachingPolicy(-1, -1); |
| 57 |
| 58 /** |
| 59 * The [ResultCachingPolicy] for [ConstantEvaluationTarget]s. |
| 60 */ |
| 61 const ResultCachingPolicy<ConstantEvaluationTarget> |
| 62 CONSTANT_EVALUATION_TARGET_POLICY = const SimpleResultCachingPolicy(-1, -1); |
| 63 |
| 64 /** |
| 52 * The [ResultCachingPolicy] for [Element]s. | 65 * The [ResultCachingPolicy] for [Element]s. |
| 53 */ | 66 */ |
| 54 const ResultCachingPolicy ELEMENT_CACHING_POLICY = | 67 const ResultCachingPolicy<Element> ELEMENT_CACHING_POLICY = |
| 55 const SimpleResultCachingPolicy(-1, -1); | 68 const SimpleResultCachingPolicy(-1, -1); |
| 56 | 69 |
| 57 /** | 70 /** |
| 58 * The [ResultCachingPolicy] for [TOKEN_STREAM]. | 71 * The [ResultCachingPolicy] for [TOKEN_STREAM]. |
| 59 */ | 72 */ |
| 60 const ResultCachingPolicy<Token> TOKEN_STREAM_CACHING_POLICY = | 73 const ResultCachingPolicy<Token> TOKEN_STREAM_CACHING_POLICY = |
| 61 const SimpleResultCachingPolicy(1, 1); | 74 const SimpleResultCachingPolicy(1, 1); |
| 62 | 75 |
| 63 /** | 76 /** |
| 77 * The [ResultCachingPolicy] for [UsedImportedElements]s. |
| 78 */ |
| 79 const ResultCachingPolicy<UsedImportedElements> USED_IMPORTED_ELEMENTS_POLICY = |
| 80 const SimpleResultCachingPolicy(-1, -1); |
| 81 |
| 82 /** |
| 83 * The [ResultCachingPolicy] for [UsedLocalElements]s. |
| 84 */ |
| 85 const ResultCachingPolicy<UsedLocalElements> USED_LOCAL_ELEMENTS_POLICY = |
| 86 const SimpleResultCachingPolicy(-1, -1); |
| 87 |
| 88 /** |
| 64 * The errors produced while resolving a library directives. | 89 * The errors produced while resolving a library directives. |
| 65 * | 90 * |
| 66 * The list will be empty if there were no errors, but will not be `null`. | 91 * The list will be empty if there were no errors, but will not be `null`. |
| 67 * | 92 * |
| 68 * The result is only available for [Source]s representing a library. | 93 * The result is only available for [Source]s representing a library. |
| 69 */ | 94 */ |
| 70 final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS = | 95 final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS = |
| 71 new ListResultDescriptor<AnalysisError>( | 96 new ListResultDescriptor<AnalysisError>( |
| 72 'BUILD_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS); | 97 'BUILD_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS); |
| 73 | 98 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 87 * constants defined at top level, statically inside classes, and local to | 112 * constants defined at top level, statically inside classes, and local to |
| 88 * functions, as well as constant constructors, annotations, and default values | 113 * functions, as well as constant constructors, annotations, and default values |
| 89 * of parameters. | 114 * of parameters. |
| 90 * | 115 * |
| 91 * The result is only available for [LibrarySpecificUnit]s. | 116 * The result is only available for [LibrarySpecificUnit]s. |
| 92 */ | 117 */ |
| 93 final ListResultDescriptor<ConstantEvaluationTarget> | 118 final ListResultDescriptor<ConstantEvaluationTarget> |
| 94 COMPILATION_UNIT_CONSTANTS = | 119 COMPILATION_UNIT_CONSTANTS = |
| 95 new ListResultDescriptor<ConstantEvaluationTarget>( | 120 new ListResultDescriptor<ConstantEvaluationTarget>( |
| 96 'COMPILATION_UNIT_CONSTANTS', null, | 121 'COMPILATION_UNIT_CONSTANTS', null, |
| 97 cachingPolicy: ELEMENT_CACHING_POLICY); | 122 cachingPolicy: CONSTANT_EVALUATION_TARGET_LIST_POLICY); |
| 98 | 123 |
| 99 /** | 124 /** |
| 100 * The element model associated with a single compilation unit. | 125 * The element model associated with a single compilation unit. |
| 101 * | 126 * |
| 102 * The result is only available for [LibrarySpecificUnit]s. | 127 * The result is only available for [LibrarySpecificUnit]s. |
| 103 */ | 128 */ |
| 104 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = | 129 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = |
| 105 new ResultDescriptor<CompilationUnitElement>( | 130 new ResultDescriptor<CompilationUnitElement>( |
| 106 'COMPILATION_UNIT_ELEMENT', null, | 131 'COMPILATION_UNIT_ELEMENT', null, |
| 107 cachingPolicy: ELEMENT_CACHING_POLICY); | 132 cachingPolicy: ELEMENT_CACHING_POLICY); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 /** | 169 /** |
| 145 * A [ConstantEvaluationTarget] that has been successfully constant-evaluated. | 170 * A [ConstantEvaluationTarget] that has been successfully constant-evaluated. |
| 146 * | 171 * |
| 147 * TODO(paulberry): is ELEMENT_CACHING_POLICY the correct caching policy? | 172 * TODO(paulberry): is ELEMENT_CACHING_POLICY the correct caching policy? |
| 148 * | 173 * |
| 149 * The result is only available for [ConstantEvaluationTarget]s. | 174 * The result is only available for [ConstantEvaluationTarget]s. |
| 150 * | 175 * |
| 151 */ | 176 */ |
| 152 final ResultDescriptor<ConstantEvaluationTarget> CONSTANT_VALUE = | 177 final ResultDescriptor<ConstantEvaluationTarget> CONSTANT_VALUE = |
| 153 new ResultDescriptor<ConstantEvaluationTarget>('CONSTANT_VALUE', null, | 178 new ResultDescriptor<ConstantEvaluationTarget>('CONSTANT_VALUE', null, |
| 154 cachingPolicy: ELEMENT_CACHING_POLICY); | 179 cachingPolicy: CONSTANT_EVALUATION_TARGET_POLICY); |
| 155 | 180 |
| 156 /** | 181 /** |
| 157 * The sources representing the libraries that include a given source as a part. | 182 * The sources representing the libraries that include a given source as a part. |
| 158 * | 183 * |
| 159 * The result is only available for [Source]s representing a compilation unit. | 184 * The result is only available for [Source]s representing a compilation unit. |
| 160 */ | 185 */ |
| 161 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = | 186 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = |
| 162 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); | 187 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); |
| 163 | 188 |
| 164 /** | 189 /** |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 * The [TypeProvider] of the [AnalysisContext]. | 793 * The [TypeProvider] of the [AnalysisContext]. |
| 769 */ | 794 */ |
| 770 final ResultDescriptor<TypeProvider> TYPE_PROVIDER = | 795 final ResultDescriptor<TypeProvider> TYPE_PROVIDER = |
| 771 new ResultDescriptor<TypeProvider>('TYPE_PROVIDER', null); | 796 new ResultDescriptor<TypeProvider>('TYPE_PROVIDER', null); |
| 772 | 797 |
| 773 /** | 798 /** |
| 774 * The [UsedImportedElements] of a [LibrarySpecificUnit]. | 799 * The [UsedImportedElements] of a [LibrarySpecificUnit]. |
| 775 */ | 800 */ |
| 776 final ResultDescriptor<UsedImportedElements> USED_IMPORTED_ELEMENTS = | 801 final ResultDescriptor<UsedImportedElements> USED_IMPORTED_ELEMENTS = |
| 777 new ResultDescriptor<UsedImportedElements>('USED_IMPORTED_ELEMENTS', null, | 802 new ResultDescriptor<UsedImportedElements>('USED_IMPORTED_ELEMENTS', null, |
| 778 cachingPolicy: ELEMENT_CACHING_POLICY); | 803 cachingPolicy: USED_IMPORTED_ELEMENTS_POLICY); |
| 779 | 804 |
| 780 /** | 805 /** |
| 781 * The [UsedLocalElements] of a [LibrarySpecificUnit]. | 806 * The [UsedLocalElements] of a [LibrarySpecificUnit]. |
| 782 */ | 807 */ |
| 783 final ResultDescriptor<UsedLocalElements> USED_LOCAL_ELEMENTS = | 808 final ResultDescriptor<UsedLocalElements> USED_LOCAL_ELEMENTS = |
| 784 new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null, | 809 new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null, |
| 785 cachingPolicy: ELEMENT_CACHING_POLICY); | 810 cachingPolicy: USED_LOCAL_ELEMENTS_POLICY); |
| 786 | 811 |
| 787 /** | 812 /** |
| 788 * The errors produced while resolving variable references in a compilation unit
. | 813 * The errors produced while resolving variable references in a compilation unit
. |
| 789 * | 814 * |
| 790 * The list will be empty if there were no errors, but will not be `null`. | 815 * The list will be empty if there were no errors, but will not be `null`. |
| 791 * | 816 * |
| 792 * The result is only available for [LibrarySpecificUnit]s. | 817 * The result is only available for [LibrarySpecificUnit]s. |
| 793 */ | 818 */ |
| 794 final ListResultDescriptor<AnalysisError> VARIABLE_REFERENCE_ERRORS = | 819 final ListResultDescriptor<AnalysisError> VARIABLE_REFERENCE_ERRORS = |
| 795 new ListResultDescriptor<AnalysisError>( | 820 new ListResultDescriptor<AnalysisError>( |
| (...skipping 4573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5369 | 5394 |
| 5370 @override | 5395 @override |
| 5371 bool moveNext() { | 5396 bool moveNext() { |
| 5372 if (_newSources.isEmpty) { | 5397 if (_newSources.isEmpty) { |
| 5373 return false; | 5398 return false; |
| 5374 } | 5399 } |
| 5375 currentTarget = _newSources.removeLast(); | 5400 currentTarget = _newSources.removeLast(); |
| 5376 return true; | 5401 return true; |
| 5377 } | 5402 } |
| 5378 } | 5403 } |
| OLD | NEW |