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 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/source/embedder.dart'; | 10 import 'package:analyzer/source/embedder.dart'; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 * source file is not scheduled to be analyzed within the context of the | 306 * source file is not scheduled to be analyzed within the context of the |
307 * given library. | 307 * given library. |
308 */ | 308 */ |
309 CancelableFuture<CompilationUnit> computeResolvedCompilationUnitAsync( | 309 CancelableFuture<CompilationUnit> computeResolvedCompilationUnitAsync( |
310 Source source, Source librarySource); | 310 Source source, Source librarySource); |
311 | 311 |
312 /** | 312 /** |
313 * Perform work until the given [result] has been computed for the given | 313 * Perform work until the given [result] has been computed for the given |
314 * [target]. Return the computed value. | 314 * [target]. Return the computed value. |
315 */ | 315 */ |
316 Object /*V*/ computeResult( | 316 Object /*=V*/ computeResult /*<V>*/ ( |
317 AnalysisTarget target, ResultDescriptor /*<V>*/ result); | 317 AnalysisTarget target, ResultDescriptor /*<V>*/ result); |
318 | 318 |
319 /** | 319 /** |
320 * Notifies the context that the client is going to stop using this context. | 320 * Notifies the context that the client is going to stop using this context. |
321 */ | 321 */ |
322 void dispose(); | 322 void dispose(); |
323 | 323 |
324 /** | 324 /** |
325 * Return `true` if the given [source] exists. | 325 * Return `true` if the given [source] exists. |
326 * | 326 * |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 */ | 468 */ |
469 CompilationUnit getResolvedCompilationUnit2( | 469 CompilationUnit getResolvedCompilationUnit2( |
470 Source unitSource, Source librarySource); | 470 Source unitSource, Source librarySource); |
471 | 471 |
472 /** | 472 /** |
473 * Return the value of the given [result] for the given [target]. | 473 * Return the value of the given [result] for the given [target]. |
474 * | 474 * |
475 * If the corresponding [target] does not exist, or the [result] is not | 475 * If the corresponding [target] does not exist, or the [result] is not |
476 * computed yet, then the default value is returned. | 476 * computed yet, then the default value is returned. |
477 */ | 477 */ |
478 Object /*V*/ getResult( | 478 Object /*=V*/ getResult /*<V>*/ ( |
479 AnalysisTarget target, ResultDescriptor /*<V>*/ result); | 479 AnalysisTarget target, ResultDescriptor /*<V>*/ result); |
480 | 480 |
481 /** | 481 /** |
482 * Return a list of the sources being analyzed in this context whose full path | 482 * Return a list of the sources being analyzed in this context whose full path |
483 * is equal to the given [path]. | 483 * is equal to the given [path]. |
484 */ | 484 */ |
485 List<Source> getSourcesWithFullName(String path); | 485 List<Source> getSourcesWithFullName(String path); |
486 | 486 |
487 /** | 487 /** |
488 * Invalidates hints in the given [librarySource] and included parts. | 488 * Invalidates hints in the given [librarySource] and included parts. |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 | 1584 |
1585 /** | 1585 /** |
1586 * Return a table mapping the sources whose content has been changed to the | 1586 * Return a table mapping the sources whose content has been changed to the |
1587 * current content of those sources. | 1587 * current content of those sources. |
1588 */ | 1588 */ |
1589 Map<Source, String> get changedContents => _changedContent; | 1589 Map<Source, String> get changedContents => _changedContent; |
1590 | 1590 |
1591 /** | 1591 /** |
1592 * Return `true` if this change set does not contain any changes. | 1592 * Return `true` if this change set does not contain any changes. |
1593 */ | 1593 */ |
1594 bool get isEmpty => addedSources.isEmpty && | 1594 bool get isEmpty => |
| 1595 addedSources.isEmpty && |
1595 changedSources.isEmpty && | 1596 changedSources.isEmpty && |
1596 _changedContent.isEmpty && | 1597 _changedContent.isEmpty && |
1597 changedRanges.isEmpty && | 1598 changedRanges.isEmpty && |
1598 removedSources.isEmpty && | 1599 removedSources.isEmpty && |
1599 removedContainers.isEmpty && | 1600 removedContainers.isEmpty && |
1600 deletedSources.isEmpty; | 1601 deletedSources.isEmpty; |
1601 | 1602 |
1602 /** | 1603 /** |
1603 * Record that the specified [source] has been added and that its content is | 1604 * Record that the specified [source] has been added and that its content is |
1604 * the default contents of the source. | 1605 * the default contents of the source. |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 /** | 2374 /** |
2374 * Return `true` if any sources were added. | 2375 * Return `true` if any sources were added. |
2375 */ | 2376 */ |
2376 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; | 2377 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; |
2377 | 2378 |
2378 /** | 2379 /** |
2379 * Return `true` if any sources were removed or deleted. | 2380 * Return `true` if any sources were removed or deleted. |
2380 */ | 2381 */ |
2381 bool get wereSourcesRemovedOrDeleted => | 2382 bool get wereSourcesRemovedOrDeleted => |
2382 _changeSet.removedSources.length > 0 || | 2383 _changeSet.removedSources.length > 0 || |
2383 _changeSet.removedContainers.length > 0 || | 2384 _changeSet.removedContainers.length > 0 || |
2384 _changeSet.deletedSources.length > 0; | 2385 _changeSet.deletedSources.length > 0; |
2385 } | 2386 } |
2386 | 2387 |
2387 /** | 2388 /** |
2388 * Analysis data for which we have a modification time. | 2389 * Analysis data for which we have a modification time. |
2389 */ | 2390 */ |
2390 class TimestampedData<E> { | 2391 class TimestampedData<E> { |
2391 /** | 2392 /** |
2392 * The modification time of the source from which the data was created. | 2393 * The modification time of the source from which the data was created. |
2393 */ | 2394 */ |
2394 final int modificationTime; | 2395 final int modificationTime; |
2395 | 2396 |
2396 /** | 2397 /** |
2397 * The data that was created from the source. | 2398 * The data that was created from the source. |
2398 */ | 2399 */ |
2399 final E data; | 2400 final E data; |
2400 | 2401 |
2401 /** | 2402 /** |
2402 * Initialize a newly created holder to associate the given [data] with the | 2403 * Initialize a newly created holder to associate the given [data] with the |
2403 * given [modificationTime]. | 2404 * given [modificationTime]. |
2404 */ | 2405 */ |
2405 TimestampedData(this.modificationTime, this.data); | 2406 TimestampedData(this.modificationTime, this.data); |
2406 } | 2407 } |
OLD | NEW |