OLD | NEW |
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 library analyzer.src.generated.engine; | 5 library analyzer.src.generated.engine; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 * also be used to perform an analysis based on a proposed future state, such as | 79 * also be used to perform an analysis based on a proposed future state, such as |
80 * the state after a refactoring. | 80 * the state after a refactoring. |
81 */ | 81 */ |
82 abstract class AnalysisContext { | 82 abstract class AnalysisContext { |
83 /** | 83 /** |
84 * An empty list of contexts. | 84 * An empty list of contexts. |
85 */ | 85 */ |
86 static const List<AnalysisContext> EMPTY_LIST = const <AnalysisContext>[]; | 86 static const List<AnalysisContext> EMPTY_LIST = const <AnalysisContext>[]; |
87 | 87 |
88 /** | 88 /** |
| 89 * The file resolver provider used to override the way file URI's are |
| 90 * resolved in some contexts. |
| 91 */ |
| 92 ResolverProvider fileResolverProvider; |
| 93 |
| 94 /** |
89 * Return the set of analysis options controlling the behavior of this | 95 * Return the set of analysis options controlling the behavior of this |
90 * context. Clients should not modify the returned set of options. The options | 96 * context. Clients should not modify the returned set of options. The options |
91 * should only be set by invoking the method [setAnalysisOptions]. | 97 * should only be set by invoking the method [setAnalysisOptions]. |
92 */ | 98 */ |
93 AnalysisOptions get analysisOptions; | 99 AnalysisOptions get analysisOptions; |
94 | 100 |
95 /** | 101 /** |
96 * Set the set of analysis options controlling the behavior of this context to | 102 * Set the set of analysis options controlling the behavior of this context to |
97 * the given [options]. Clients can safely assume that all necessary analysis | 103 * the given [options]. Clients can safely assume that all necessary analysis |
98 * results have been invalidated. | 104 * results have been invalidated. |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 * Return `true` if the given [source] exists. | 332 * Return `true` if the given [source] exists. |
327 * | 333 * |
328 * This method should be used rather than the method [Source.exists] because | 334 * This method should be used rather than the method [Source.exists] because |
329 * contexts can have local overrides of the content of a source that the | 335 * contexts can have local overrides of the content of a source that the |
330 * source is not aware of and a source with local content is considered to | 336 * source is not aware of and a source with local content is considered to |
331 * exist even if there is no file on disk. | 337 * exist even if there is no file on disk. |
332 */ | 338 */ |
333 bool exists(Source source); | 339 bool exists(Source source); |
334 | 340 |
335 /** | 341 /** |
336 * The file resolver provider used to override the way file URI's are | |
337 * resolved in some contexts. | |
338 */ | |
339 ResolverProvider fileResolverProvider; | |
340 | |
341 /** | |
342 * Return the element model corresponding to the compilation unit defined by | 342 * Return the element model corresponding to the compilation unit defined by |
343 * the given [unitSource] in the library defined by the given [librarySource], | 343 * the given [unitSource] in the library defined by the given [librarySource], |
344 * or `null` if the element model does not currently exist or if the library | 344 * or `null` if the element model does not currently exist or if the library |
345 * cannot be analyzed for some reason. | 345 * cannot be analyzed for some reason. |
346 */ | 346 */ |
347 CompilationUnitElement getCompilationUnitElement( | 347 CompilationUnitElement getCompilationUnitElement( |
348 Source unitSource, Source librarySource); | 348 Source unitSource, Source librarySource); |
349 | 349 |
350 /** | 350 /** |
351 * Return configuration data associated with the given key or the [key]'s | 351 * Return configuration data associated with the given key or the [key]'s |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 * Object, and are allowed to reference `super`. | 1088 * Object, and are allowed to reference `super`. |
1089 */ | 1089 */ |
1090 bool get enableSuperMixins; | 1090 bool get enableSuperMixins; |
1091 | 1091 |
1092 /** | 1092 /** |
1093 * Return `true` if timing data should be gathered during execution. | 1093 * Return `true` if timing data should be gathered during execution. |
1094 */ | 1094 */ |
1095 bool get enableTiming; | 1095 bool get enableTiming; |
1096 | 1096 |
1097 /** | 1097 /** |
| 1098 * A flag indicating whether finer grained dependencies should be used |
| 1099 * instead of just source level dependencies. |
| 1100 * |
| 1101 * This option is experimental and subject to change. |
| 1102 */ |
| 1103 bool get finerGrainedInvalidation; |
| 1104 |
| 1105 /** |
1098 * Return `true` if errors, warnings and hints should be generated for sources | 1106 * Return `true` if errors, warnings and hints should be generated for sources |
1099 * that are implicitly being analyzed. The default value is `true`. | 1107 * that are implicitly being analyzed. The default value is `true`. |
1100 */ | 1108 */ |
1101 bool get generateImplicitErrors; | 1109 bool get generateImplicitErrors; |
1102 | 1110 |
1103 /** | 1111 /** |
1104 * Return `true` if errors, warnings and hints should be generated for sources | 1112 * Return `true` if errors, warnings and hints should be generated for sources |
1105 * in the SDK. The default value is `false`. | 1113 * in the SDK. The default value is `false`. |
1106 */ | 1114 */ |
1107 bool get generateSdkErrors; | 1115 bool get generateSdkErrors; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 | 1154 |
1147 /** | 1155 /** |
1148 * Return `true` if dependencies between computed results should be tracked | 1156 * Return `true` if dependencies between computed results should be tracked |
1149 * by analysis cache. This option should only be set to `false` if analysis | 1157 * by analysis cache. This option should only be set to `false` if analysis |
1150 * is performed in such a way that none of the inputs is ever changed | 1158 * is performed in such a way that none of the inputs is ever changed |
1151 * during the life time of the context. | 1159 * during the life time of the context. |
1152 */ | 1160 */ |
1153 bool get trackCacheDependencies; | 1161 bool get trackCacheDependencies; |
1154 | 1162 |
1155 /** | 1163 /** |
1156 * A flag indicating whether finer grained dependencies should be used | |
1157 * instead of just source level dependencies. | |
1158 * | |
1159 * This option is experimental and subject to change. | |
1160 */ | |
1161 bool get finerGrainedInvalidation; | |
1162 | |
1163 /** | |
1164 * Return an integer encoding of the values of the options that need to be the | 1164 * Return an integer encoding of the values of the options that need to be the |
1165 * same across all of the contexts associated with partitions that are to be | 1165 * same across all of the contexts associated with partitions that are to be |
1166 * shared by a single analysis context. | 1166 * shared by a single analysis context. |
1167 */ | 1167 */ |
1168 int encodeCrossContextOptions(); | 1168 int encodeCrossContextOptions(); |
1169 | 1169 |
1170 /** | 1170 /** |
1171 * Set the values of the cross-context options to match those in the given set | 1171 * Set the values of the cross-context options to match those in the given set |
1172 * of [options]. | 1172 * of [options]. |
1173 */ | 1173 */ |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 enableGenericMethods = options.enableGenericMethods; | 1419 enableGenericMethods = options.enableGenericMethods; |
1420 enableStrictCallChecks = options.enableStrictCallChecks; | 1420 enableStrictCallChecks = options.enableStrictCallChecks; |
1421 enableSuperMixins = options.enableSuperMixins; | 1421 enableSuperMixins = options.enableSuperMixins; |
1422 strongMode = options.strongMode; | 1422 strongMode = options.strongMode; |
1423 if (options is AnalysisOptionsImpl) { | 1423 if (options is AnalysisOptionsImpl) { |
1424 strongModeHints = options.strongModeHints; | 1424 strongModeHints = options.strongModeHints; |
1425 } | 1425 } |
1426 } | 1426 } |
1427 | 1427 |
1428 /** | 1428 /** |
| 1429 * Produce a human readable list of option names corresponding to the options |
| 1430 * encoded in the given [encoding], presumably from invoking the method |
| 1431 * [encodeCrossContextOptions]. |
| 1432 */ |
| 1433 static String decodeCrossContextOptions(int encoding) { |
| 1434 if (encoding == 0) { |
| 1435 return 'none'; |
| 1436 } |
| 1437 StringBuffer buffer = new StringBuffer(); |
| 1438 bool needsSeparator = false; |
| 1439 void add(String optionName) { |
| 1440 if (needsSeparator) { |
| 1441 buffer.write(', '); |
| 1442 } |
| 1443 buffer.write(optionName); |
| 1444 needsSeparator = true; |
| 1445 } |
| 1446 if (encoding & ENABLE_ASSERT_FLAG > 0) { |
| 1447 add('assert'); |
| 1448 } |
| 1449 if (encoding & ENABLE_ASYNC_FLAG > 0) { |
| 1450 add('async'); |
| 1451 } |
| 1452 if (encoding & ENABLE_GENERIC_METHODS_FLAG > 0) { |
| 1453 add('genericMethods'); |
| 1454 } |
| 1455 if (encoding & ENABLE_STRICT_CALL_CHECKS_FLAG > 0) { |
| 1456 add('strictCallChecks'); |
| 1457 } |
| 1458 if (encoding & ENABLE_STRONG_MODE_FLAG > 0) { |
| 1459 add('strongMode'); |
| 1460 } |
| 1461 if (encoding & ENABLE_STRONG_MODE_HINTS_FLAG > 0) { |
| 1462 add('strongModeHints'); |
| 1463 } |
| 1464 if (encoding & ENABLE_SUPER_MIXINS_FLAG > 0) { |
| 1465 add('superMixins'); |
| 1466 } |
| 1467 return buffer.toString(); |
| 1468 } |
| 1469 |
| 1470 /** |
1429 * Predicate used for [analyzeFunctionBodiesPredicate] when | 1471 * Predicate used for [analyzeFunctionBodiesPredicate] when |
1430 * [analyzeFunctionBodies] is set to `true`. | 1472 * [analyzeFunctionBodies] is set to `true`. |
1431 */ | 1473 */ |
1432 static bool _analyzeAllFunctionBodies(Source _) => true; | 1474 static bool _analyzeAllFunctionBodies(Source _) => true; |
1433 | 1475 |
1434 /** | 1476 /** |
1435 * Predicate used for [analyzeFunctionBodiesPredicate] when | 1477 * Predicate used for [analyzeFunctionBodiesPredicate] when |
1436 * [analyzeFunctionBodies] is set to `false`. | 1478 * [analyzeFunctionBodies] is set to `false`. |
1437 */ | 1479 */ |
1438 static bool _analyzeNoFunctionBodies(Source _) => false; | 1480 static bool _analyzeNoFunctionBodies(Source _) => false; |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 * The data that was created from the source. | 2655 * The data that was created from the source. |
2614 */ | 2656 */ |
2615 final E data; | 2657 final E data; |
2616 | 2658 |
2617 /** | 2659 /** |
2618 * Initialize a newly created holder to associate the given [data] with the | 2660 * Initialize a newly created holder to associate the given [data] with the |
2619 * given [modificationTime]. | 2661 * given [modificationTime]. |
2620 */ | 2662 */ |
2621 TimestampedData(this.modificationTime, this.data); | 2663 TimestampedData(this.modificationTime, this.data); |
2622 } | 2664 } |
OLD | NEW |