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 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/instrumentation/instrumentation.dart'; |
10 import 'package:analyzer/source/embedder.dart'; | 11 import 'package:analyzer/source/embedder.dart'; |
11 import 'package:analyzer/src/cancelable_future.dart'; | 12 import 'package:analyzer/src/cancelable_future.dart'; |
12 import 'package:analyzer/src/context/cache.dart'; | 13 import 'package:analyzer/src/context/cache.dart'; |
13 import 'package:analyzer/src/context/context.dart'; | 14 import 'package:analyzer/src/context/context.dart'; |
| 15 import 'package:analyzer/src/generated/ast.dart'; |
| 16 import 'package:analyzer/src/generated/constant.dart'; |
| 17 import 'package:analyzer/src/generated/element.dart'; |
| 18 import 'package:analyzer/src/generated/error.dart'; |
| 19 import 'package:analyzer/src/generated/java_core.dart'; |
| 20 import 'package:analyzer/src/generated/java_engine.dart'; |
| 21 import 'package:analyzer/src/generated/resolver.dart'; |
| 22 import 'package:analyzer/src/generated/source.dart'; |
| 23 import 'package:analyzer/src/generated/utilities_general.dart'; |
14 import 'package:analyzer/src/plugin/command_line_plugin.dart'; | 24 import 'package:analyzer/src/plugin/command_line_plugin.dart'; |
15 import 'package:analyzer/src/plugin/engine_plugin.dart'; | 25 import 'package:analyzer/src/plugin/engine_plugin.dart'; |
16 import 'package:analyzer/src/plugin/options_plugin.dart'; | 26 import 'package:analyzer/src/plugin/options_plugin.dart'; |
17 import 'package:analyzer/src/task/manager.dart'; | 27 import 'package:analyzer/src/task/manager.dart'; |
18 import 'package:analyzer/task/dart.dart'; | 28 import 'package:analyzer/task/dart.dart'; |
19 import 'package:analyzer/task/model.dart'; | 29 import 'package:analyzer/task/model.dart'; |
20 import 'package:html/dom.dart' show Document; | 30 import 'package:html/dom.dart' show Document; |
21 import 'package:path/path.dart' as pathos; | 31 import 'package:path/path.dart' as pathos; |
22 import 'package:plugin/manager.dart'; | 32 import 'package:plugin/manager.dart'; |
23 import 'package:plugin/plugin.dart'; | 33 import 'package:plugin/plugin.dart'; |
24 | 34 |
25 import '../../instrumentation/instrumentation.dart'; | |
26 import 'ast.dart'; | |
27 import 'constant.dart'; | |
28 import 'element.dart'; | |
29 import 'error.dart'; | |
30 import 'java_core.dart'; | |
31 import 'java_engine.dart'; | |
32 import 'resolver.dart'; | |
33 import 'source.dart'; | |
34 import 'utilities_general.dart'; | |
35 | |
36 /** | 35 /** |
37 * Used by [AnalysisOptions] to allow function bodies to be analyzed in some | 36 * Used by [AnalysisOptions] to allow function bodies to be analyzed in some |
38 * sources but not others. | 37 * sources but not others. |
39 */ | 38 */ |
40 typedef bool AnalyzeFunctionBodiesPredicate(Source source); | 39 typedef bool AnalyzeFunctionBodiesPredicate(Source source); |
41 | 40 |
42 /** | 41 /** |
43 * A context in which a single analysis can be performed and incrementally | 42 * A context in which a single analysis can be performed and incrementally |
44 * maintained. The context includes such information as the version of the SDK | 43 * maintained. The context includes such information as the version of the SDK |
45 * being analyzed against as well as the package-root used to resolve 'package:' | 44 * being analyzed against as well as the package-root used to resolve 'package:' |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 | 1583 |
1585 /** | 1584 /** |
1586 * Return a table mapping the sources whose content has been changed to the | 1585 * Return a table mapping the sources whose content has been changed to the |
1587 * current content of those sources. | 1586 * current content of those sources. |
1588 */ | 1587 */ |
1589 Map<Source, String> get changedContents => _changedContent; | 1588 Map<Source, String> get changedContents => _changedContent; |
1590 | 1589 |
1591 /** | 1590 /** |
1592 * Return `true` if this change set does not contain any changes. | 1591 * Return `true` if this change set does not contain any changes. |
1593 */ | 1592 */ |
1594 bool get isEmpty => addedSources.isEmpty && | 1593 bool get isEmpty => |
| 1594 addedSources.isEmpty && |
1595 changedSources.isEmpty && | 1595 changedSources.isEmpty && |
1596 _changedContent.isEmpty && | 1596 _changedContent.isEmpty && |
1597 changedRanges.isEmpty && | 1597 changedRanges.isEmpty && |
1598 removedSources.isEmpty && | 1598 removedSources.isEmpty && |
1599 removedContainers.isEmpty && | 1599 removedContainers.isEmpty && |
1600 deletedSources.isEmpty; | 1600 deletedSources.isEmpty; |
1601 | 1601 |
1602 /** | 1602 /** |
1603 * Record that the specified [source] has been added and that its content is | 1603 * Record that the specified [source] has been added and that its content is |
1604 * the default contents of the source. | 1604 * the default contents of the source. |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 /** | 2373 /** |
2374 * Return `true` if any sources were added. | 2374 * Return `true` if any sources were added. |
2375 */ | 2375 */ |
2376 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; | 2376 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; |
2377 | 2377 |
2378 /** | 2378 /** |
2379 * Return `true` if any sources were removed or deleted. | 2379 * Return `true` if any sources were removed or deleted. |
2380 */ | 2380 */ |
2381 bool get wereSourcesRemovedOrDeleted => | 2381 bool get wereSourcesRemovedOrDeleted => |
2382 _changeSet.removedSources.length > 0 || | 2382 _changeSet.removedSources.length > 0 || |
2383 _changeSet.removedContainers.length > 0 || | 2383 _changeSet.removedContainers.length > 0 || |
2384 _changeSet.deletedSources.length > 0; | 2384 _changeSet.deletedSources.length > 0; |
2385 } | 2385 } |
2386 | 2386 |
2387 /** | 2387 /** |
2388 * Analysis data for which we have a modification time. | 2388 * Analysis data for which we have a modification time. |
2389 */ | 2389 */ |
2390 class TimestampedData<E> { | 2390 class TimestampedData<E> { |
2391 /** | 2391 /** |
2392 * The modification time of the source from which the data was created. | 2392 * The modification time of the source from which the data was created. |
2393 */ | 2393 */ |
2394 final int modificationTime; | 2394 final int modificationTime; |
2395 | 2395 |
2396 /** | 2396 /** |
2397 * The data that was created from the source. | 2397 * The data that was created from the source. |
2398 */ | 2398 */ |
2399 final E data; | 2399 final E data; |
2400 | 2400 |
2401 /** | 2401 /** |
2402 * Initialize a newly created holder to associate the given [data] with the | 2402 * Initialize a newly created holder to associate the given [data] with the |
2403 * given [modificationTime]. | 2403 * given [modificationTime]. |
2404 */ | 2404 */ |
2405 TimestampedData(this.modificationTime, this.data); | 2405 TimestampedData(this.modificationTime, this.data); |
2406 } | 2406 } |
OLD | NEW |