| 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'; |
| 11 import 'package:analyzer/dart/ast/visitor.dart'; | 11 import 'package:analyzer/dart/ast/visitor.dart'; |
| 12 import 'package:analyzer/dart/element/element.dart'; | 12 import 'package:analyzer/dart/element/element.dart'; |
| 13 import 'package:analyzer/error/error.dart'; | 13 import 'package:analyzer/error/error.dart'; |
| 14 import 'package:analyzer/exception/exception.dart'; | 14 import 'package:analyzer/exception/exception.dart'; |
| 15 import 'package:analyzer/instrumentation/instrumentation.dart'; | 15 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 16 import 'package:analyzer/plugin/resolver_provider.dart'; | 16 import 'package:analyzer/plugin/resolver_provider.dart'; |
| 17 import 'package:analyzer/source/error_processor.dart'; |
| 17 import 'package:analyzer/src/cancelable_future.dart'; | 18 import 'package:analyzer/src/cancelable_future.dart'; |
| 18 import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator; | 19 import 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator; |
| 19 import 'package:analyzer/src/context/cache.dart'; | 20 import 'package:analyzer/src/context/cache.dart'; |
| 20 import 'package:analyzer/src/context/context.dart'; | 21 import 'package:analyzer/src/context/context.dart'; |
| 21 import 'package:analyzer/src/generated/constant.dart'; | 22 import 'package:analyzer/src/generated/constant.dart'; |
| 22 import 'package:analyzer/src/generated/java_engine.dart'; | 23 import 'package:analyzer/src/generated/java_engine.dart'; |
| 23 import 'package:analyzer/src/generated/resolver.dart'; | 24 import 'package:analyzer/src/generated/resolver.dart'; |
| 24 import 'package:analyzer/src/generated/source.dart'; | 25 import 'package:analyzer/src/generated/source.dart'; |
| 25 import 'package:analyzer/src/generated/utilities_general.dart'; | 26 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 26 import 'package:analyzer/src/plugin/command_line_plugin.dart'; | 27 import 'package:analyzer/src/plugin/command_line_plugin.dart'; |
| 27 import 'package:analyzer/src/plugin/engine_plugin.dart'; | 28 import 'package:analyzer/src/plugin/engine_plugin.dart'; |
| 28 import 'package:analyzer/src/plugin/options_plugin.dart'; | 29 import 'package:analyzer/src/plugin/options_plugin.dart'; |
| 30 import 'package:analyzer/src/services/lint.dart'; |
| 29 import 'package:analyzer/src/task/manager.dart'; | 31 import 'package:analyzer/src/task/manager.dart'; |
| 30 import 'package:analyzer/task/dart.dart'; | 32 import 'package:analyzer/task/dart.dart'; |
| 31 import 'package:analyzer/task/model.dart'; | 33 import 'package:analyzer/task/model.dart'; |
| 32 import 'package:front_end/src/base/timestamped_data.dart'; | 34 import 'package:front_end/src/base/timestamped_data.dart'; |
| 33 import 'package:html/dom.dart' show Document; | 35 import 'package:html/dom.dart' show Document; |
| 34 import 'package:path/path.dart' as pathos; | 36 import 'package:path/path.dart' as pathos; |
| 35 import 'package:plugin/manager.dart'; | 37 import 'package:plugin/manager.dart'; |
| 36 import 'package:plugin/plugin.dart'; | 38 import 'package:plugin/plugin.dart'; |
| 37 | 39 |
| 38 export 'package:analyzer/error/listener.dart' show RecordingErrorListener; | 40 export 'package:analyzer/error/listener.dart' show RecordingErrorListener; |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 */ | 352 */ |
| 351 CompilationUnitElement getCompilationUnitElement( | 353 CompilationUnitElement getCompilationUnitElement( |
| 352 Source unitSource, Source librarySource); | 354 Source unitSource, Source librarySource); |
| 353 | 355 |
| 354 /** | 356 /** |
| 355 * Return configuration data associated with the given key or the [key]'s | 357 * Return configuration data associated with the given key or the [key]'s |
| 356 * default value if no state has been associated. | 358 * default value if no state has been associated. |
| 357 * | 359 * |
| 358 * See [setConfigurationData]. | 360 * See [setConfigurationData]. |
| 359 */ | 361 */ |
| 362 @deprecated |
| 360 Object/*=V*/ getConfigurationData/*<V>*/(ResultDescriptor/*<V>*/ key); | 363 Object/*=V*/ getConfigurationData/*<V>*/(ResultDescriptor/*<V>*/ key); |
| 361 | 364 |
| 362 /** | 365 /** |
| 363 * Return the contents and timestamp of the given [source]. | 366 * Return the contents and timestamp of the given [source]. |
| 364 * | 367 * |
| 365 * This method should be used rather than the method [Source.getContents] | 368 * This method should be used rather than the method [Source.getContents] |
| 366 * because contexts can have local overrides of the content of a source that | 369 * because contexts can have local overrides of the content of a source that |
| 367 * the source is not aware of. | 370 * the source is not aware of. |
| 368 */ | 371 */ |
| 369 TimestampedData<String> getContents(Source source); | 372 TimestampedData<String> getContents(Source source); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 * is used by the context to determine what reanalysis is necessary. | 620 * is used by the context to determine what reanalysis is necessary. |
| 618 */ | 621 */ |
| 619 void setChangedContents( | 622 void setChangedContents( |
| 620 Source source, String contents, int offset, int oldLength, int newLength); | 623 Source source, String contents, int offset, int oldLength, int newLength); |
| 621 | 624 |
| 622 /** | 625 /** |
| 623 * Associate this configuration [data] object with the given descriptor [key]. | 626 * Associate this configuration [data] object with the given descriptor [key]. |
| 624 * | 627 * |
| 625 * See [getConfigurationData]. | 628 * See [getConfigurationData]. |
| 626 */ | 629 */ |
| 630 @deprecated |
| 627 void setConfigurationData(ResultDescriptor key, Object data); | 631 void setConfigurationData(ResultDescriptor key, Object data); |
| 628 | 632 |
| 629 /** | 633 /** |
| 630 * Set the contents of the given [source] to the given [contents] and mark the | 634 * Set the contents of the given [source] to the given [contents] and mark the |
| 631 * source as having changed. This has the effect of overriding the default | 635 * source as having changed. This has the effect of overriding the default |
| 632 * contents of the source. If the contents are `null` the override is removed | 636 * contents of the source. If the contents are `null` the override is removed |
| 633 * so that the default contents will be returned. | 637 * so that the default contents will be returned. |
| 634 */ | 638 */ |
| 635 void setContents(Source source, String contents); | 639 void setContents(Source source, String contents); |
| 636 } | 640 } |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 * Object, and are allowed to reference `super`. | 1148 * Object, and are allowed to reference `super`. |
| 1145 */ | 1149 */ |
| 1146 bool get enableSuperMixins; | 1150 bool get enableSuperMixins; |
| 1147 | 1151 |
| 1148 /** | 1152 /** |
| 1149 * Return `true` if timing data should be gathered during execution. | 1153 * Return `true` if timing data should be gathered during execution. |
| 1150 */ | 1154 */ |
| 1151 bool get enableTiming; | 1155 bool get enableTiming; |
| 1152 | 1156 |
| 1153 /** | 1157 /** |
| 1158 * Return a list of error processors that are to be used when reporting |
| 1159 * errors in some analysis context. |
| 1160 */ |
| 1161 List<ErrorProcessor> get errorProcessors; |
| 1162 |
| 1163 /** |
| 1164 * Return a list of exclude patterns used to exclude some sources from |
| 1165 * analysis. |
| 1166 */ |
| 1167 List<String> get excludePatterns; |
| 1168 |
| 1169 /** |
| 1154 * A flag indicating whether finer grained dependencies should be used | 1170 * A flag indicating whether finer grained dependencies should be used |
| 1155 * instead of just source level dependencies. | 1171 * instead of just source level dependencies. |
| 1156 * | 1172 * |
| 1157 * This option is experimental and subject to change. | 1173 * This option is experimental and subject to change. |
| 1158 */ | 1174 */ |
| 1159 bool get finerGrainedInvalidation; | 1175 bool get finerGrainedInvalidation; |
| 1160 | 1176 |
| 1161 /** | 1177 /** |
| 1162 * Return `true` if errors, warnings and hints should be generated for sources | 1178 * Return `true` if errors, warnings and hints should be generated for sources |
| 1163 * that are implicitly being analyzed. The default value is `true`. | 1179 * that are implicitly being analyzed. The default value is `true`. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1192 * analysis. | 1208 * analysis. |
| 1193 */ | 1209 */ |
| 1194 bool get incrementalValidation; | 1210 bool get incrementalValidation; |
| 1195 | 1211 |
| 1196 /** | 1212 /** |
| 1197 * Return `true` if analysis is to generate lint warnings. | 1213 * Return `true` if analysis is to generate lint warnings. |
| 1198 */ | 1214 */ |
| 1199 bool get lint; | 1215 bool get lint; |
| 1200 | 1216 |
| 1201 /** | 1217 /** |
| 1218 * Return a list of the lint rules that are to be run in an analysis context |
| 1219 * if [lint] returns `true`. |
| 1220 */ |
| 1221 List<Linter> get lintRules; |
| 1222 |
| 1223 /** |
| 1202 * Return the "platform" bit mask which should be used to apply patch files, | 1224 * Return the "platform" bit mask which should be used to apply patch files, |
| 1203 * or `0` if no patch files should be applied. | 1225 * or `0` if no patch files should be applied. |
| 1204 */ | 1226 */ |
| 1205 int get patchPlatform; | 1227 int get patchPlatform; |
| 1206 | 1228 |
| 1207 /** | 1229 /** |
| 1208 * Return `true` if analysis is to parse comments. | 1230 * Return `true` if analysis is to parse comments. |
| 1209 */ | 1231 */ |
| 1210 bool get preserveComments; | 1232 bool get preserveComments; |
| 1211 | 1233 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 | 1332 |
| 1311 @override | 1333 @override |
| 1312 bool enableStrictCallChecks = false; | 1334 bool enableStrictCallChecks = false; |
| 1313 | 1335 |
| 1314 @override | 1336 @override |
| 1315 bool enableSuperMixins = false; | 1337 bool enableSuperMixins = false; |
| 1316 | 1338 |
| 1317 @override | 1339 @override |
| 1318 bool enableTiming = false; | 1340 bool enableTiming = false; |
| 1319 | 1341 |
| 1342 /** |
| 1343 * A list of error processors that are to be used when reporting errors in |
| 1344 * some analysis context. |
| 1345 */ |
| 1346 List<ErrorProcessor> _errorProcessors; |
| 1347 |
| 1348 /** |
| 1349 * A list of exclude patterns used to exclude some sources from analysis. |
| 1350 */ |
| 1351 List<String> _excludePatterns; |
| 1352 |
| 1320 @override | 1353 @override |
| 1321 bool generateImplicitErrors = true; | 1354 bool generateImplicitErrors = true; |
| 1322 | 1355 |
| 1323 @override | 1356 @override |
| 1324 bool generateSdkErrors = false; | 1357 bool generateSdkErrors = false; |
| 1325 | 1358 |
| 1326 @override | 1359 @override |
| 1327 bool hint = true; | 1360 bool hint = true; |
| 1328 | 1361 |
| 1329 @override | 1362 @override |
| 1330 bool incremental = false; | 1363 bool incremental = false; |
| 1331 | 1364 |
| 1332 @override | 1365 @override |
| 1333 bool incrementalApi = false; | 1366 bool incrementalApi = false; |
| 1334 | 1367 |
| 1335 @override | 1368 @override |
| 1336 bool incrementalValidation = false; | 1369 bool incrementalValidation = false; |
| 1337 | 1370 |
| 1338 @override | 1371 @override |
| 1339 bool lint = false; | 1372 bool lint = false; |
| 1340 | 1373 |
| 1374 /** |
| 1375 * The lint rules that are to be run in an analysis context if [lint] returns |
| 1376 * `true`. |
| 1377 */ |
| 1378 List<Linter> _lintRules; |
| 1379 |
| 1341 @override | 1380 @override |
| 1342 int patchPlatform = 0; | 1381 int patchPlatform = 0; |
| 1343 | 1382 |
| 1344 @override | 1383 @override |
| 1345 bool preserveComments = true; | 1384 bool preserveComments = true; |
| 1346 | 1385 |
| 1347 @override | 1386 @override |
| 1348 bool strongMode = false; | 1387 bool strongMode = false; |
| 1349 | 1388 |
| 1350 /** | 1389 /** |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 AnalysisOptionsImpl.from(AnalysisOptions options) { | 1442 AnalysisOptionsImpl.from(AnalysisOptions options) { |
| 1404 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; | 1443 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
| 1405 dart2jsHint = options.dart2jsHint; | 1444 dart2jsHint = options.dart2jsHint; |
| 1406 enableAssertInitializer = options.enableAssertInitializer; | 1445 enableAssertInitializer = options.enableAssertInitializer; |
| 1407 enableAssertMessage = options.enableAssertMessage; | 1446 enableAssertMessage = options.enableAssertMessage; |
| 1408 enableStrictCallChecks = options.enableStrictCallChecks; | 1447 enableStrictCallChecks = options.enableStrictCallChecks; |
| 1409 enableInitializingFormalAccess = options.enableInitializingFormalAccess; | 1448 enableInitializingFormalAccess = options.enableInitializingFormalAccess; |
| 1410 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; | 1449 enableLazyAssignmentOperators = options.enableLazyAssignmentOperators; |
| 1411 enableSuperMixins = options.enableSuperMixins; | 1450 enableSuperMixins = options.enableSuperMixins; |
| 1412 enableTiming = options.enableTiming; | 1451 enableTiming = options.enableTiming; |
| 1452 errorProcessors = options.errorProcessors; |
| 1453 excludePatterns = options.excludePatterns; |
| 1413 generateImplicitErrors = options.generateImplicitErrors; | 1454 generateImplicitErrors = options.generateImplicitErrors; |
| 1414 generateSdkErrors = options.generateSdkErrors; | 1455 generateSdkErrors = options.generateSdkErrors; |
| 1415 hint = options.hint; | 1456 hint = options.hint; |
| 1416 incremental = options.incremental; | 1457 incremental = options.incremental; |
| 1417 incrementalApi = options.incrementalApi; | 1458 incrementalApi = options.incrementalApi; |
| 1418 incrementalValidation = options.incrementalValidation; | 1459 incrementalValidation = options.incrementalValidation; |
| 1419 lint = options.lint; | 1460 lint = options.lint; |
| 1461 lintRules = options.lintRules; |
| 1420 preserveComments = options.preserveComments; | 1462 preserveComments = options.preserveComments; |
| 1421 strongMode = options.strongMode; | 1463 strongMode = options.strongMode; |
| 1422 if (options is AnalysisOptionsImpl) { | 1464 if (options is AnalysisOptionsImpl) { |
| 1423 strongModeHints = options.strongModeHints; | 1465 strongModeHints = options.strongModeHints; |
| 1424 implicitCasts = options.implicitCasts; | 1466 implicitCasts = options.implicitCasts; |
| 1425 nonnullableTypes = options.nonnullableTypes; | 1467 nonnullableTypes = options.nonnullableTypes; |
| 1426 implicitDynamic = options.implicitDynamic; | 1468 implicitDynamic = options.implicitDynamic; |
| 1427 } | 1469 } |
| 1428 trackCacheDependencies = options.trackCacheDependencies; | 1470 trackCacheDependencies = options.trackCacheDependencies; |
| 1429 disableCacheFlushing = options.disableCacheFlushing; | 1471 disableCacheFlushing = options.disableCacheFlushing; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 void set enableConditionalDirectives(_) {} | 1519 void set enableConditionalDirectives(_) {} |
| 1478 | 1520 |
| 1479 @override | 1521 @override |
| 1480 @deprecated | 1522 @deprecated |
| 1481 bool get enableGenericMethods => true; | 1523 bool get enableGenericMethods => true; |
| 1482 | 1524 |
| 1483 @deprecated | 1525 @deprecated |
| 1484 void set enableGenericMethods(bool enable) {} | 1526 void set enableGenericMethods(bool enable) {} |
| 1485 | 1527 |
| 1486 @override | 1528 @override |
| 1529 List<ErrorProcessor> get errorProcessors => |
| 1530 _errorProcessors ??= const <ErrorProcessor>[]; |
| 1531 |
| 1532 /** |
| 1533 * Set the list of error [processors] that are to be used when reporting |
| 1534 * errors in some analysis context. |
| 1535 */ |
| 1536 void set errorProcessors(List<ErrorProcessor> processors) { |
| 1537 _errorProcessors = processors; |
| 1538 } |
| 1539 |
| 1540 @override |
| 1541 List<String> get excludePatterns => _excludePatterns ??= const <String>[]; |
| 1542 |
| 1543 /** |
| 1544 * Set the exclude patterns used to exclude some sources from analysis to |
| 1545 * those in the given list of [patterns]. |
| 1546 */ |
| 1547 void set excludePatterns(List<String> patterns) { |
| 1548 _excludePatterns = patterns; |
| 1549 } |
| 1550 |
| 1551 @override |
| 1552 List<Linter> get lintRules => _lintRules ??= const <Linter>[]; |
| 1553 |
| 1554 /** |
| 1555 * Set the lint rules that are to be run in an analysis context if [lint] |
| 1556 * returns `true`. |
| 1557 */ |
| 1558 void set lintRules(List<Linter> rules) { |
| 1559 _lintRules = rules; |
| 1560 } |
| 1561 |
| 1562 @override |
| 1487 List<int> encodeCrossContextOptions() { | 1563 List<int> encodeCrossContextOptions() { |
| 1488 int flags = (enableAssertMessage ? ENABLE_ASSERT_FLAG : 0) | | 1564 int flags = (enableAssertMessage ? ENABLE_ASSERT_FLAG : 0) | |
| 1489 (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) | | 1565 (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) | |
| 1490 (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) | | 1566 (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) | |
| 1491 (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) | | 1567 (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) | |
| 1492 (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) | | 1568 (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) | |
| 1493 (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0); | 1569 (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0); |
| 1494 return <int>[flags, patchPlatform]; | 1570 return <int>[flags, patchPlatform]; |
| 1495 } | 1571 } |
| 1496 | 1572 |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2714 */ | 2790 */ |
| 2715 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; | 2791 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; |
| 2716 | 2792 |
| 2717 /** | 2793 /** |
| 2718 * Return `true` if any sources were removed or deleted. | 2794 * Return `true` if any sources were removed or deleted. |
| 2719 */ | 2795 */ |
| 2720 bool get wereSourcesRemoved => | 2796 bool get wereSourcesRemoved => |
| 2721 _changeSet.removedSources.length > 0 || | 2797 _changeSet.removedSources.length > 0 || |
| 2722 _changeSet.removedContainers.length > 0; | 2798 _changeSet.removedContainers.length > 0; |
| 2723 } | 2799 } |
| OLD | NEW |