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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1098 |
1099 /** | 1099 /** |
1100 * Return `true` if the parser is to parse asserts in the initializer list of | 1100 * Return `true` if the parser is to parse asserts in the initializer list of |
1101 * a constructor. | 1101 * a constructor. |
1102 */ | 1102 */ |
1103 bool get enableAssertInitializer; | 1103 bool get enableAssertInitializer; |
1104 | 1104 |
1105 /** | 1105 /** |
1106 * Return `true` to enable custom assert messages (DEP 37). | 1106 * Return `true` to enable custom assert messages (DEP 37). |
1107 */ | 1107 */ |
| 1108 @deprecated |
1108 bool get enableAssertMessage; | 1109 bool get enableAssertMessage; |
1109 | 1110 |
1110 /** | 1111 /** |
1111 * Return `true` to if analysis is to enable async support. | 1112 * Return `true` to if analysis is to enable async support. |
1112 */ | 1113 */ |
1113 @deprecated | 1114 @deprecated |
1114 bool get enableAsync; | 1115 bool get enableAsync; |
1115 | 1116 |
1116 /** | 1117 /** |
1117 * Return `true` to enable interface libraries (DEP 40). | 1118 * Return `true` to enable interface libraries (DEP 40). |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1296 class AnalysisOptionsImpl implements AnalysisOptions { | 1297 class AnalysisOptionsImpl implements AnalysisOptions { |
1297 /** | 1298 /** |
1298 * DEPRECATED: The maximum number of sources for which data should be kept in | 1299 * DEPRECATED: The maximum number of sources for which data should be kept in |
1299 * the cache. | 1300 * the cache. |
1300 * | 1301 * |
1301 * This constant no longer has any effect. | 1302 * This constant no longer has any effect. |
1302 */ | 1303 */ |
1303 @deprecated | 1304 @deprecated |
1304 static const int DEFAULT_CACHE_SIZE = 64; | 1305 static const int DEFAULT_CACHE_SIZE = 64; |
1305 | 1306 |
1306 static const int ENABLE_ASSERT_FLAG = 0x01; | 1307 static const int ENABLE_LAZY_ASSIGNMENT_OPERATORS = 0x01; |
1307 static const int ENABLE_LAZY_ASSIGNMENT_OPERATORS = 0x02; | 1308 static const int ENABLE_STRICT_CALL_CHECKS_FLAG = 0x02; |
1308 static const int ENABLE_STRICT_CALL_CHECKS_FLAG = 0x04; | 1309 static const int ENABLE_STRONG_MODE_FLAG = 0x04; |
1309 static const int ENABLE_STRONG_MODE_FLAG = 0x08; | 1310 static const int ENABLE_STRONG_MODE_HINTS_FLAG = 0x08; |
1310 static const int ENABLE_STRONG_MODE_HINTS_FLAG = 0x10; | 1311 static const int ENABLE_SUPER_MIXINS_FLAG = 0x10; |
1311 static const int ENABLE_SUPER_MIXINS_FLAG = 0x20; | |
1312 | 1312 |
1313 /** | 1313 /** |
1314 * The default list of non-nullable type names. | 1314 * The default list of non-nullable type names. |
1315 */ | 1315 */ |
1316 static const List<String> NONNULLABLE_TYPES = const <String>[]; | 1316 static const List<String> NONNULLABLE_TYPES = const <String>[]; |
1317 | 1317 |
1318 /** | 1318 /** |
1319 * A predicate indicating whether analysis is to parse and analyze function | 1319 * A predicate indicating whether analysis is to parse and analyze function |
1320 * bodies. | 1320 * bodies. |
1321 */ | 1321 */ |
1322 AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate = | 1322 AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate = |
1323 _analyzeAllFunctionBodies; | 1323 _analyzeAllFunctionBodies; |
1324 | 1324 |
1325 @override | 1325 @override |
1326 @deprecated | 1326 @deprecated |
1327 int cacheSize = 64; | 1327 int cacheSize = 64; |
1328 | 1328 |
1329 @override | 1329 @override |
1330 bool dart2jsHint = false; | 1330 bool dart2jsHint = false; |
1331 | 1331 |
1332 @override | 1332 @override |
1333 bool enableAssertInitializer = false; | 1333 bool enableAssertInitializer = false; |
1334 | 1334 |
1335 @override | 1335 @override |
1336 bool enableAssertMessage = false; | |
1337 | |
1338 @override | |
1339 bool enableLazyAssignmentOperators = false; | 1336 bool enableLazyAssignmentOperators = false; |
1340 | 1337 |
1341 @override | 1338 @override |
1342 bool enableStrictCallChecks = false; | 1339 bool enableStrictCallChecks = false; |
1343 | 1340 |
1344 @override | 1341 @override |
1345 bool enableSuperMixins = false; | 1342 bool enableSuperMixins = false; |
1346 | 1343 |
1347 @override | 1344 @override |
1348 bool enableTiming = false; | 1345 bool enableTiming = false; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 AnalysisOptionsImpl(); | 1444 AnalysisOptionsImpl(); |
1448 | 1445 |
1449 /** | 1446 /** |
1450 * Initialize a newly created set of analysis options to have the same values | 1447 * Initialize a newly created set of analysis options to have the same values |
1451 * as those in the given set of analysis [options]. | 1448 * as those in the given set of analysis [options]. |
1452 */ | 1449 */ |
1453 AnalysisOptionsImpl.from(AnalysisOptions options) { | 1450 AnalysisOptionsImpl.from(AnalysisOptions options) { |
1454 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; | 1451 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
1455 dart2jsHint = options.dart2jsHint; | 1452 dart2jsHint = options.dart2jsHint; |
1456 enableAssertInitializer = options.enableAssertInitializer; | 1453 enableAssertInitializer = options.enableAssertInitializer; |
1457 enableAssertMessage = options.enableAssertMessage; | |
1458 enableStrictCallChecks = options.enableStrictCallChecks; | 1454 enableStrictCallChecks = options.enableStrictCallChecks; |
1459 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; | 1455 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; |
1460 enableSuperMixins = options.enableSuperMixins; | 1456 enableSuperMixins = options.enableSuperMixins; |
1461 enableTiming = options.enableTiming; | 1457 enableTiming = options.enableTiming; |
1462 errorProcessors = options.errorProcessors; | 1458 errorProcessors = options.errorProcessors; |
1463 excludePatterns = options.excludePatterns; | 1459 excludePatterns = options.excludePatterns; |
1464 generateImplicitErrors = options.generateImplicitErrors; | 1460 generateImplicitErrors = options.generateImplicitErrors; |
1465 generateSdkErrors = options.generateSdkErrors; | 1461 generateSdkErrors = options.generateSdkErrors; |
1466 hint = options.hint; | 1462 hint = options.hint; |
1467 incremental = options.incremental; | 1463 incremental = options.incremental; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate => | 1502 AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate => |
1507 _analyzeFunctionBodiesPredicate; | 1503 _analyzeFunctionBodiesPredicate; |
1508 | 1504 |
1509 set analyzeFunctionBodiesPredicate(AnalyzeFunctionBodiesPredicate value) { | 1505 set analyzeFunctionBodiesPredicate(AnalyzeFunctionBodiesPredicate value) { |
1510 if (value == null) { | 1506 if (value == null) { |
1511 throw new ArgumentError.notNull('analyzeFunctionBodiesPredicate'); | 1507 throw new ArgumentError.notNull('analyzeFunctionBodiesPredicate'); |
1512 } | 1508 } |
1513 _analyzeFunctionBodiesPredicate = value; | 1509 _analyzeFunctionBodiesPredicate = value; |
1514 } | 1510 } |
1515 | 1511 |
| 1512 @override |
| 1513 @deprecated |
| 1514 bool get enableAssertMessage => true; |
| 1515 |
| 1516 @deprecated |
| 1517 void set enableAssertMessage(bool enable) {} |
| 1518 |
1516 @deprecated | 1519 @deprecated |
1517 @override | 1520 @override |
1518 bool get enableAsync => true; | 1521 bool get enableAsync => true; |
1519 | 1522 |
1520 @deprecated | 1523 @deprecated |
1521 void set enableAsync(bool enable) {} | 1524 void set enableAsync(bool enable) {} |
1522 | 1525 |
1523 /** | 1526 /** |
1524 * A flag indicating whether interface libraries are to be supported (DEP 40). | 1527 * A flag indicating whether interface libraries are to be supported (DEP 40). |
1525 */ | 1528 */ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 /** | 1574 /** |
1572 * Set the lint rules that are to be run in an analysis context if [lint] | 1575 * Set the lint rules that are to be run in an analysis context if [lint] |
1573 * returns `true`. | 1576 * returns `true`. |
1574 */ | 1577 */ |
1575 void set lintRules(List<Linter> rules) { | 1578 void set lintRules(List<Linter> rules) { |
1576 _lintRules = rules; | 1579 _lintRules = rules; |
1577 } | 1580 } |
1578 | 1581 |
1579 @override | 1582 @override |
1580 List<int> encodeCrossContextOptions() { | 1583 List<int> encodeCrossContextOptions() { |
1581 int flags = (enableAssertMessage ? ENABLE_ASSERT_FLAG : 0) | | 1584 int flags = |
1582 (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) | | 1585 (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) | |
1583 (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) | | 1586 (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) | |
1584 (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) | | 1587 (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) | |
1585 (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) | | 1588 (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) | |
1586 (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0); | 1589 (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0); |
1587 return <int>[flags, patchPlatform]; | 1590 return <int>[flags, patchPlatform]; |
1588 } | 1591 } |
1589 | 1592 |
1590 @override | 1593 @override |
1591 void resetToDefaults() { | 1594 void resetToDefaults() { |
1592 dart2jsHint = false; | 1595 dart2jsHint = false; |
1593 disableCacheFlushing = false; | 1596 disableCacheFlushing = false; |
1594 enableAssertInitializer = false; | 1597 enableAssertInitializer = false; |
1595 enableAssertMessage = false; | |
1596 enableLazyAssignmentOperators = false; | 1598 enableLazyAssignmentOperators = false; |
1597 enableStrictCallChecks = false; | 1599 enableStrictCallChecks = false; |
1598 enableSuperMixins = false; | 1600 enableSuperMixins = false; |
1599 enableTiming = false; | 1601 enableTiming = false; |
1600 enableUriInPartOf = false; | 1602 enableUriInPartOf = false; |
1601 _errorProcessors = null; | 1603 _errorProcessors = null; |
1602 _excludePatterns = null; | 1604 _excludePatterns = null; |
1603 finerGrainedInvalidation = false; | 1605 finerGrainedInvalidation = false; |
1604 generateImplicitErrors = true; | 1606 generateImplicitErrors = true; |
1605 generateSdkErrors = false; | 1607 generateSdkErrors = false; |
1606 hint = true; | 1608 hint = true; |
1607 implicitCasts = true; | 1609 implicitCasts = true; |
1608 implicitDynamic = true; | 1610 implicitDynamic = true; |
1609 incremental = false; | 1611 incremental = false; |
1610 incrementalApi = false; | 1612 incrementalApi = false; |
1611 incrementalValidation = false; | 1613 incrementalValidation = false; |
1612 lint = false; | 1614 lint = false; |
1613 _lintRules = null; | 1615 _lintRules = null; |
1614 nonnullableTypes = NONNULLABLE_TYPES; | 1616 nonnullableTypes = NONNULLABLE_TYPES; |
1615 patchPlatform = 0; | 1617 patchPlatform = 0; |
1616 preserveComments = true; | 1618 preserveComments = true; |
1617 strongMode = false; | 1619 strongMode = false; |
1618 strongModeHints = false; | 1620 strongModeHints = false; |
1619 trackCacheDependencies = true; | 1621 trackCacheDependencies = true; |
1620 } | 1622 } |
1621 | 1623 |
1622 @override | 1624 @override |
1623 void setCrossContextOptionsFrom(AnalysisOptions options) { | 1625 void setCrossContextOptionsFrom(AnalysisOptions options) { |
1624 enableAssertMessage = options.enableAssertMessage; | |
1625 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; | 1626 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; |
1626 enableStrictCallChecks = options.enableStrictCallChecks; | 1627 enableStrictCallChecks = options.enableStrictCallChecks; |
1627 enableSuperMixins = options.enableSuperMixins; | 1628 enableSuperMixins = options.enableSuperMixins; |
1628 strongMode = options.strongMode; | 1629 strongMode = options.strongMode; |
1629 if (options is AnalysisOptionsImpl) { | 1630 if (options is AnalysisOptionsImpl) { |
1630 strongModeHints = options.strongModeHints; | 1631 strongModeHints = options.strongModeHints; |
1631 } | 1632 } |
1632 patchPlatform = options.patchPlatform; | 1633 patchPlatform = options.patchPlatform; |
1633 } | 1634 } |
1634 | 1635 |
1635 /** | 1636 /** |
1636 * Produce a human readable list of option names corresponding to the options | 1637 * Produce a human readable list of option names corresponding to the options |
1637 * encoded in the given [encoding], presumably from invoking the method | 1638 * encoded in the given [encoding], presumably from invoking the method |
1638 * [encodeCrossContextOptions]. | 1639 * [encodeCrossContextOptions]. |
1639 */ | 1640 */ |
1640 static String decodeCrossContextOptions(List<int> encoding) { | 1641 static String decodeCrossContextOptions(List<int> encoding) { |
1641 List<String> parts = []; | 1642 List<String> parts = []; |
1642 int flags = encoding[0]; | 1643 int flags = encoding[0]; |
1643 if (flags & ENABLE_ASSERT_FLAG > 0) { | |
1644 parts.add('assert'); | |
1645 } | |
1646 if (flags & ENABLE_LAZY_ASSIGNMENT_OPERATORS > 0) { | 1644 if (flags & ENABLE_LAZY_ASSIGNMENT_OPERATORS > 0) { |
1647 parts.add('lazyAssignmentOperators'); | 1645 parts.add('lazyAssignmentOperators'); |
1648 } | 1646 } |
1649 if (flags & ENABLE_STRICT_CALL_CHECKS_FLAG > 0) { | 1647 if (flags & ENABLE_STRICT_CALL_CHECKS_FLAG > 0) { |
1650 parts.add('strictCallChecks'); | 1648 parts.add('strictCallChecks'); |
1651 } | 1649 } |
1652 if (flags & ENABLE_SUPER_MIXINS_FLAG > 0) { | 1650 if (flags & ENABLE_SUPER_MIXINS_FLAG > 0) { |
1653 parts.add('superMixins'); | 1651 parts.add('superMixins'); |
1654 } | 1652 } |
1655 if (flags & ENABLE_STRONG_MODE_FLAG > 0) { | 1653 if (flags & ENABLE_STRONG_MODE_FLAG > 0) { |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 */ | 2837 */ |
2840 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; | 2838 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; |
2841 | 2839 |
2842 /** | 2840 /** |
2843 * Return `true` if any sources were removed or deleted. | 2841 * Return `true` if any sources were removed or deleted. |
2844 */ | 2842 */ |
2845 bool get wereSourcesRemoved => | 2843 bool get wereSourcesRemoved => |
2846 _changeSet.removedSources.length > 0 || | 2844 _changeSet.removedSources.length > 0 || |
2847 _changeSet.removedContainers.length > 0; | 2845 _changeSet.removedContainers.length > 0; |
2848 } | 2846 } |
OLD | NEW |