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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 class AnalysisNotScheduledError implements Exception {} | 1056 class AnalysisNotScheduledError implements Exception {} |
1057 | 1057 |
1058 /** | 1058 /** |
1059 * A set of analysis options used to control the behavior of an analysis | 1059 * A set of analysis options used to control the behavior of an analysis |
1060 * context. | 1060 * context. |
1061 */ | 1061 */ |
1062 abstract class AnalysisOptions { | 1062 abstract class AnalysisOptions { |
1063 /** | 1063 /** |
1064 * The length of the list returned by [encodeCrossContextOptions]. | 1064 * The length of the list returned by [encodeCrossContextOptions]. |
1065 */ | 1065 */ |
1066 static const int crossContextOptionsLength = 2; | 1066 static const int crossContextOptionsLength = 1; |
1067 | 1067 |
1068 /** | 1068 /** |
1069 * Function that returns `true` if analysis is to parse and analyze function | 1069 * Function that returns `true` if analysis is to parse and analyze function |
1070 * bodies for a given source. | 1070 * bodies for a given source. |
1071 */ | 1071 */ |
1072 AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate; | 1072 AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate; |
1073 | 1073 |
1074 /** | 1074 /** |
1075 * DEPRECATED: Return the maximum number of sources for which AST structures s
hould be | 1075 * DEPRECATED: Return the maximum number of sources for which AST structures s
hould be |
1076 * kept in the cache. | 1076 * kept in the cache. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 */ | 1221 */ |
1222 bool get lint; | 1222 bool get lint; |
1223 | 1223 |
1224 /** | 1224 /** |
1225 * Return a list of the lint rules that are to be run in an analysis context | 1225 * Return a list of the lint rules that are to be run in an analysis context |
1226 * if [lint] returns `true`. | 1226 * if [lint] returns `true`. |
1227 */ | 1227 */ |
1228 List<Linter> get lintRules; | 1228 List<Linter> get lintRules; |
1229 | 1229 |
1230 /** | 1230 /** |
1231 * Return the "platform" bit mask which should be used to apply patch files, | 1231 * A mapping from Dart SDK library name (e.g. "dart:core") to a list of paths |
1232 * or `0` if no patch files should be applied. | 1232 * to patch files that should be applied to the library. |
1233 */ | 1233 */ |
1234 int get patchPlatform; | 1234 Map<String, List<String>> get patchPaths; |
1235 | 1235 |
1236 /** | 1236 /** |
1237 * Return `true` if analysis is to parse comments. | 1237 * Return `true` if analysis is to parse comments. |
1238 */ | 1238 */ |
1239 bool get preserveComments; | 1239 bool get preserveComments; |
1240 | 1240 |
1241 /** | 1241 /** |
1242 * Return `true` if strong mode analysis should be used. | 1242 * Return `true` if strong mode analysis should be used. |
1243 */ | 1243 */ |
1244 bool get strongMode; | 1244 bool get strongMode; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 | 1378 |
1379 @override | 1379 @override |
1380 bool lint = false; | 1380 bool lint = false; |
1381 | 1381 |
1382 /** | 1382 /** |
1383 * The lint rules that are to be run in an analysis context if [lint] returns | 1383 * The lint rules that are to be run in an analysis context if [lint] returns |
1384 * `true`. | 1384 * `true`. |
1385 */ | 1385 */ |
1386 List<Linter> _lintRules; | 1386 List<Linter> _lintRules; |
1387 | 1387 |
1388 @override | 1388 Map<String, List<String>> patchPaths = {}; |
1389 int patchPlatform = 0; | |
1390 | 1389 |
1391 @override | 1390 @override |
1392 bool preserveComments = true; | 1391 bool preserveComments = true; |
1393 | 1392 |
1394 @override | 1393 @override |
1395 bool strongMode = false; | 1394 bool strongMode = false; |
1396 | 1395 |
1397 /** | 1396 /** |
1398 * A flag indicating whether strong-mode inference hints should be | 1397 * A flag indicating whether strong-mode inference hints should be |
1399 * used. This flag is not exposed in the interface, and should be | 1398 * used. This flag is not exposed in the interface, and should be |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 strongMode = options.strongMode; | 1468 strongMode = options.strongMode; |
1470 if (options is AnalysisOptionsImpl) { | 1469 if (options is AnalysisOptionsImpl) { |
1471 strongModeHints = options.strongModeHints; | 1470 strongModeHints = options.strongModeHints; |
1472 implicitCasts = options.implicitCasts; | 1471 implicitCasts = options.implicitCasts; |
1473 nonnullableTypes = options.nonnullableTypes; | 1472 nonnullableTypes = options.nonnullableTypes; |
1474 implicitDynamic = options.implicitDynamic; | 1473 implicitDynamic = options.implicitDynamic; |
1475 } | 1474 } |
1476 trackCacheDependencies = options.trackCacheDependencies; | 1475 trackCacheDependencies = options.trackCacheDependencies; |
1477 disableCacheFlushing = options.disableCacheFlushing; | 1476 disableCacheFlushing = options.disableCacheFlushing; |
1478 finerGrainedInvalidation = options.finerGrainedInvalidation; | 1477 finerGrainedInvalidation = options.finerGrainedInvalidation; |
1479 patchPlatform = options.patchPlatform; | 1478 patchPaths = options.patchPaths; |
1480 } | 1479 } |
1481 | 1480 |
1482 bool get analyzeFunctionBodies { | 1481 bool get analyzeFunctionBodies { |
1483 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { | 1482 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { |
1484 return true; | 1483 return true; |
1485 } else if (identical( | 1484 } else if (identical( |
1486 analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) { | 1485 analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) { |
1487 return false; | 1486 return false; |
1488 } else { | 1487 } else { |
1489 throw new StateError('analyzeFunctionBodiesPredicate in use'); | 1488 throw new StateError('analyzeFunctionBodiesPredicate in use'); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 } | 1579 } |
1581 | 1580 |
1582 @override | 1581 @override |
1583 List<int> encodeCrossContextOptions() { | 1582 List<int> encodeCrossContextOptions() { |
1584 int flags = | 1583 int flags = |
1585 (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) | | 1584 (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) | |
1586 (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) | | 1585 (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) | |
1587 (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) | | 1586 (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) | |
1588 (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) | | 1587 (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) | |
1589 (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0); | 1588 (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0); |
1590 return <int>[flags, patchPlatform]; | 1589 return <int>[flags]; |
1591 } | 1590 } |
1592 | 1591 |
1593 @override | 1592 @override |
1594 void resetToDefaults() { | 1593 void resetToDefaults() { |
1595 dart2jsHint = false; | 1594 dart2jsHint = false; |
1596 disableCacheFlushing = false; | 1595 disableCacheFlushing = false; |
1597 enableAssertInitializer = false; | 1596 enableAssertInitializer = false; |
1598 enableLazyAssignmentOperators = false; | 1597 enableLazyAssignmentOperators = false; |
1599 enableStrictCallChecks = false; | 1598 enableStrictCallChecks = false; |
1600 enableSuperMixins = false; | 1599 enableSuperMixins = false; |
1601 enableTiming = false; | 1600 enableTiming = false; |
1602 enableUriInPartOf = false; | 1601 enableUriInPartOf = false; |
1603 _errorProcessors = null; | 1602 _errorProcessors = null; |
1604 _excludePatterns = null; | 1603 _excludePatterns = null; |
1605 finerGrainedInvalidation = false; | 1604 finerGrainedInvalidation = false; |
1606 generateImplicitErrors = true; | 1605 generateImplicitErrors = true; |
1607 generateSdkErrors = false; | 1606 generateSdkErrors = false; |
1608 hint = true; | 1607 hint = true; |
1609 implicitCasts = true; | 1608 implicitCasts = true; |
1610 implicitDynamic = true; | 1609 implicitDynamic = true; |
1611 incremental = false; | 1610 incremental = false; |
1612 incrementalApi = false; | 1611 incrementalApi = false; |
1613 incrementalValidation = false; | 1612 incrementalValidation = false; |
1614 lint = false; | 1613 lint = false; |
1615 _lintRules = null; | 1614 _lintRules = null; |
1616 nonnullableTypes = NONNULLABLE_TYPES; | 1615 nonnullableTypes = NONNULLABLE_TYPES; |
1617 patchPlatform = 0; | 1616 patchPaths = {}; |
1618 preserveComments = true; | 1617 preserveComments = true; |
1619 strongMode = false; | 1618 strongMode = false; |
1620 strongModeHints = false; | 1619 strongModeHints = false; |
1621 trackCacheDependencies = true; | 1620 trackCacheDependencies = true; |
1622 } | 1621 } |
1623 | 1622 |
1624 @override | 1623 @override |
1625 void setCrossContextOptionsFrom(AnalysisOptions options) { | 1624 void setCrossContextOptionsFrom(AnalysisOptions options) { |
1626 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; | 1625 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; |
1627 enableStrictCallChecks = options.enableStrictCallChecks; | 1626 enableStrictCallChecks = options.enableStrictCallChecks; |
1628 enableSuperMixins = options.enableSuperMixins; | 1627 enableSuperMixins = options.enableSuperMixins; |
1629 strongMode = options.strongMode; | 1628 strongMode = options.strongMode; |
1630 if (options is AnalysisOptionsImpl) { | 1629 if (options is AnalysisOptionsImpl) { |
1631 strongModeHints = options.strongModeHints; | 1630 strongModeHints = options.strongModeHints; |
1632 } | 1631 } |
1633 patchPlatform = options.patchPlatform; | |
1634 } | 1632 } |
1635 | 1633 |
1636 /** | 1634 /** |
1637 * Produce a human readable list of option names corresponding to the options | 1635 * Produce a human readable list of option names corresponding to the options |
1638 * encoded in the given [encoding], presumably from invoking the method | 1636 * encoded in the given [encoding], presumably from invoking the method |
1639 * [encodeCrossContextOptions]. | 1637 * [encodeCrossContextOptions]. |
1640 */ | 1638 */ |
1641 static String decodeCrossContextOptions(List<int> encoding) { | 1639 static String decodeCrossContextOptions(List<int> encoding) { |
1642 List<String> parts = []; | 1640 List<String> parts = []; |
1643 int flags = encoding[0]; | 1641 int flags = encoding[0]; |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2837 */ | 2835 */ |
2838 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; | 2836 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; |
2839 | 2837 |
2840 /** | 2838 /** |
2841 * Return `true` if any sources were removed or deleted. | 2839 * Return `true` if any sources were removed or deleted. |
2842 */ | 2840 */ |
2843 bool get wereSourcesRemoved => | 2841 bool get wereSourcesRemoved => |
2844 _changeSet.removedSources.length > 0 || | 2842 _changeSet.removedSources.length > 0 || |
2845 _changeSet.removedContainers.length > 0; | 2843 _changeSet.removedContainers.length > 0; |
2846 } | 2844 } |
OLD | NEW |