| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.index; | 8 library engine.index; |
| 9 | 9 |
| 10 import 'dart:collection' show Queue; | 10 import 'dart:collection' show Queue; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 * @param source the [Source] to remove from index | 46 * @param source the [Source] to remove from index |
| 47 */ | 47 */ |
| 48 RemoveSourceOperation(IndexStore indexStore, AnalysisContext context, this.sou
rce) { | 48 RemoveSourceOperation(IndexStore indexStore, AnalysisContext context, this.sou
rce) { |
| 49 this._indexStore = indexStore; | 49 this._indexStore = indexStore; |
| 50 this._context = context; | 50 this._context = context; |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool get isQuery => false; | 53 bool get isQuery => false; |
| 54 | 54 |
| 55 void performOperation() { | 55 void performOperation() { |
| 56 { | 56 _indexStore.removeSource(_context, source); |
| 57 _indexStore.removeSource(_context, source); | |
| 58 } | |
| 59 } | 57 } |
| 60 | 58 |
| 61 bool removeWhenSourceRemoved(Source source) => false; | 59 bool removeWhenSourceRemoved(Source source) => false; |
| 62 | 60 |
| 63 String toString() => "RemoveSource(${source.fullName})"; | 61 String toString() => "RemoveSource(${source.fullName})"; |
| 64 } | 62 } |
| 65 | 63 |
| 66 /** | 64 /** |
| 67 * The interface [IndexOperation] defines the behavior of objects used to perfor
m operations | 65 * The interface [IndexOperation] defines the behavior of objects used to perfor
m operations |
| 68 * on an index. | 66 * on an index. |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 640 } |
| 643 | 641 |
| 644 /** | 642 /** |
| 645 * @return the [Source] to be indexed. | 643 * @return the [Source] to be indexed. |
| 646 */ | 644 */ |
| 647 Source get source => _source; | 645 Source get source => _source; |
| 648 | 646 |
| 649 bool get isQuery => false; | 647 bool get isQuery => false; |
| 650 | 648 |
| 651 void performOperation() { | 649 void performOperation() { |
| 652 { | 650 try { |
| 653 try { | 651 bool mayIndex = _indexStore.aboutToIndex(_context, _unitElement); |
| 654 bool mayIndex = _indexStore.aboutToIndex(_context, _unitElement); | 652 if (!mayIndex) { |
| 655 if (!mayIndex) { | 653 return; |
| 656 return; | |
| 657 } | |
| 658 unit.accept(new IndexContributor(_indexStore)); | |
| 659 unit.accept(new AngularDartIndexContributor(_indexStore)); | |
| 660 } catch (exception) { | |
| 661 AnalysisEngine.instance.logger.logError2("Could not index ${unit.element
.location}", exception); | |
| 662 } | 654 } |
| 655 unit.accept(new IndexContributor(_indexStore)); |
| 656 unit.accept(new AngularDartIndexContributor(_indexStore)); |
| 657 } catch (exception) { |
| 658 AnalysisEngine.instance.logger.logError2("Could not index ${unit.element.l
ocation}", exception); |
| 663 } | 659 } |
| 664 } | 660 } |
| 665 | 661 |
| 666 bool removeWhenSourceRemoved(Source source) => this._source == source; | 662 bool removeWhenSourceRemoved(Source source) => this._source == source; |
| 667 | 663 |
| 668 String toString() => "IndexUnitOperation(${_source.fullName})"; | 664 String toString() => "IndexUnitOperation(${_source.fullName})"; |
| 669 } | 665 } |
| 670 | 666 |
| 671 /** | 667 /** |
| 672 * Recursively visits [HtmlUnit] and every embedded [Expression]. | 668 * Recursively visits [HtmlUnit] and every embedded [Expression]. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 */ | 720 */ |
| 725 static Map<String, Relationship> _RelationshipMap = {}; | 721 static Map<String, Relationship> _RelationshipMap = {}; |
| 726 | 722 |
| 727 /** | 723 /** |
| 728 * Return the relationship with the given unique identifier. | 724 * Return the relationship with the given unique identifier. |
| 729 * | 725 * |
| 730 * @param uniqueId the unique identifier for the relationship | 726 * @param uniqueId the unique identifier for the relationship |
| 731 * @return the relationship with the given unique identifier | 727 * @return the relationship with the given unique identifier |
| 732 */ | 728 */ |
| 733 static Relationship getRelationship(String uniqueId) { | 729 static Relationship getRelationship(String uniqueId) { |
| 734 { | 730 Relationship relationship = _RelationshipMap[uniqueId]; |
| 735 Relationship relationship = _RelationshipMap[uniqueId]; | 731 if (relationship == null) { |
| 736 if (relationship == null) { | 732 relationship = new Relationship(uniqueId); |
| 737 relationship = new Relationship(uniqueId); | 733 _RelationshipMap[uniqueId] = relationship; |
| 738 _RelationshipMap[uniqueId] = relationship; | |
| 739 } | |
| 740 return relationship; | |
| 741 } | 734 } |
| 735 return relationship; |
| 742 } | 736 } |
| 743 | 737 |
| 744 /** | 738 /** |
| 745 * @return all registered [Relationship]s. | 739 * @return all registered [Relationship]s. |
| 746 */ | 740 */ |
| 747 static Iterable<Relationship> values() => _RelationshipMap.values; | 741 static Iterable<Relationship> values() => _RelationshipMap.values; |
| 748 | 742 |
| 749 /** | 743 /** |
| 750 * Initialize a newly created relationship to have the given unique identifier
. | 744 * Initialize a newly created relationship to have the given unique identifier
. |
| 751 * | 745 * |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 * @param container the [SourceContainer] to remove from index | 853 * @param container the [SourceContainer] to remove from index |
| 860 */ | 854 */ |
| 861 RemoveSourcesOperation(IndexStore indexStore, AnalysisContext context, this.co
ntainer) { | 855 RemoveSourcesOperation(IndexStore indexStore, AnalysisContext context, this.co
ntainer) { |
| 862 this._indexStore = indexStore; | 856 this._indexStore = indexStore; |
| 863 this._context = context; | 857 this._context = context; |
| 864 } | 858 } |
| 865 | 859 |
| 866 bool get isQuery => false; | 860 bool get isQuery => false; |
| 867 | 861 |
| 868 void performOperation() { | 862 void performOperation() { |
| 869 { | 863 _indexStore.removeSources(_context, container); |
| 870 _indexStore.removeSources(_context, container); | |
| 871 } | |
| 872 } | 864 } |
| 873 | 865 |
| 874 bool removeWhenSourceRemoved(Source source) => false; | 866 bool removeWhenSourceRemoved(Source source) => false; |
| 875 | 867 |
| 876 String toString() => "RemoveSources(${container})"; | 868 String toString() => "RemoveSources(${container})"; |
| 877 } | 869 } |
| 878 | 870 |
| 879 /** | 871 /** |
| 880 * The interface `UniverseElement` defines element to use when we want to reques
t "defines" | 872 * The interface `UniverseElement` defines element to use when we want to reques
t "defines" |
| 881 * relations without specifying exact library. | 873 * relations without specifying exact library. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 this._queue = queue; | 906 this._queue = queue; |
| 915 } | 907 } |
| 916 | 908 |
| 917 /** | 909 /** |
| 918 * Start processing operations. If the processor is already running on a diffe
rent thread, then | 910 * Start processing operations. If the processor is already running on a diffe
rent thread, then |
| 919 * this method will return immediately with no effect. Otherwise, this method
will not return | 911 * this method will return immediately with no effect. Otherwise, this method
will not return |
| 920 * until after the processor has been stopped from a different thread or until
the thread running | 912 * until after the processor has been stopped from a different thread or until
the thread running |
| 921 * the processor has been interrupted. | 913 * the processor has been interrupted. |
| 922 */ | 914 */ |
| 923 void run() { | 915 void run() { |
| 924 { | 916 // This processor is, or was, already running on a different thread. |
| 925 // This processor is, or was, already running on a different thread. | 917 if (_state != ProcessorState.READY) { |
| 926 if (_state != ProcessorState.READY) { | 918 throw new IllegalStateException("Operation processors can only be run one
time"); |
| 927 throw new IllegalStateException("Operation processors can only be run on
e time"); | |
| 928 } | |
| 929 // OK, run. | |
| 930 _state = ProcessorState.RUNNING; | |
| 931 } | 919 } |
| 920 // OK, run. |
| 921 _state = ProcessorState.RUNNING; |
| 932 try { | 922 try { |
| 933 while (isRunning) { | 923 while (isRunning) { |
| 934 // wait for operation | 924 // wait for operation |
| 935 IndexOperation operation = null; | 925 IndexOperation operation = null; |
| 936 { | 926 { |
| 937 operation = _queue.dequeue(_WAIT_DURATION); | 927 operation = _queue.dequeue(_WAIT_DURATION); |
| 938 } | 928 } |
| 939 // perform operation | 929 // perform operation |
| 940 if (operation != null) { | 930 if (operation != null) { |
| 941 try { | 931 try { |
| 942 operation.performOperation(); | 932 operation.performOperation(); |
| 943 } catch (exception) { | 933 } catch (exception) { |
| 944 AnalysisEngine.instance.logger.logError2("Exception in indexing oper
ation: ${operation}", exception); | 934 AnalysisEngine.instance.logger.logError2("Exception in indexing oper
ation: ${operation}", exception); |
| 945 } | 935 } |
| 946 } | 936 } |
| 947 } | 937 } |
| 948 } finally { | 938 } finally { |
| 949 { | 939 _state = ProcessorState.STOPPED; |
| 950 _state = ProcessorState.STOPPED; | |
| 951 } | |
| 952 } | 940 } |
| 953 } | 941 } |
| 954 | 942 |
| 955 /** | 943 /** |
| 956 * Stop processing operations after the current operation has completed. If th
e argument is | 944 * Stop processing operations after the current operation has completed. If th
e argument is |
| 957 * `true` then this method will wait until the last operation has completed; o
therwise this | 945 * `true` then this method will wait until the last operation has completed; o
therwise this |
| 958 * method might return before the last operation has completed. | 946 * method might return before the last operation has completed. |
| 959 * | 947 * |
| 960 * @param wait `true` if this method will wait until the last operation has co
mpleted before | 948 * @param wait `true` if this method will wait until the last operation has co
mpleted before |
| 961 * returning | 949 * returning |
| 962 * @return the library files for the libraries that need to be analyzed when a
new session is | 950 * @return the library files for the libraries that need to be analyzed when a
new session is |
| 963 * started. | 951 * started. |
| 964 */ | 952 */ |
| 965 List<Source> stop(bool wait) { | 953 List<Source> stop(bool wait) { |
| 966 { | 954 if (identical(_state, ProcessorState.READY)) { |
| 967 if (identical(_state, ProcessorState.READY)) { | 955 _state = ProcessorState.STOPPED; |
| 968 _state = ProcessorState.STOPPED; | 956 return unanalyzedSources; |
| 969 return unanalyzedSources; | 957 } else if (identical(_state, ProcessorState.STOPPED)) { |
| 970 } else if (identical(_state, ProcessorState.STOPPED)) { | 958 return unanalyzedSources; |
| 971 return unanalyzedSources; | 959 } else if (identical(_state, ProcessorState.RUNNING)) { |
| 972 } else if (identical(_state, ProcessorState.RUNNING)) { | 960 _state = ProcessorState.STOP_REQESTED; |
| 973 _state = ProcessorState.STOP_REQESTED; | |
| 974 } | |
| 975 } | 961 } |
| 976 while (wait) { | 962 while (wait) { |
| 977 { | 963 if (identical(_state, ProcessorState.STOPPED)) { |
| 978 if (identical(_state, ProcessorState.STOPPED)) { | 964 return unanalyzedSources; |
| 979 return unanalyzedSources; | |
| 980 } | |
| 981 } | 965 } |
| 982 waitOneMs(); | 966 waitOneMs(); |
| 983 } | 967 } |
| 984 return unanalyzedSources; | 968 return unanalyzedSources; |
| 985 } | 969 } |
| 986 | 970 |
| 987 /** | 971 /** |
| 988 * Waits until processors will switch from "ready" to "running" state. | 972 * Waits until processors will switch from "ready" to "running" state. |
| 989 * | 973 * |
| 990 * @return `true` if processor is now actually in "running" state, e.g. not in
"stopped" | 974 * @return `true` if processor is now actually in "running" state, e.g. not in
"stopped" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1009 } | 993 } |
| 1010 } | 994 } |
| 1011 return new List.from(sources); | 995 return new List.from(sources); |
| 1012 } | 996 } |
| 1013 | 997 |
| 1014 /** | 998 /** |
| 1015 * Return `true` if the current state is [ProcessorState#RUNNING]. | 999 * Return `true` if the current state is [ProcessorState#RUNNING]. |
| 1016 * | 1000 * |
| 1017 * @return `true` if this processor is running | 1001 * @return `true` if this processor is running |
| 1018 */ | 1002 */ |
| 1019 bool get isRunning { | 1003 bool get isRunning => identical(_state, ProcessorState.RUNNING); |
| 1020 { | |
| 1021 return identical(_state, ProcessorState.RUNNING); | |
| 1022 } | |
| 1023 } | |
| 1024 | 1004 |
| 1025 void threadYield() { | 1005 void threadYield() { |
| 1026 } | 1006 } |
| 1027 | 1007 |
| 1028 void waitOneMs() { | 1008 void waitOneMs() { |
| 1029 } | 1009 } |
| 1030 } | 1010 } |
| 1031 | 1011 |
| 1032 /** | 1012 /** |
| 1033 * The enumeration <code>ProcessorState</code> represents the possible states of
an operation | 1013 * The enumeration <code>ProcessorState</code> represents the possible states of
an operation |
| (...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2406 * [Object#wait]. In particular, it is not possible to cause this method to wa
it for | 2386 * [Object#wait]. In particular, it is not possible to cause this method to wa
it for |
| 2407 * an indefinite period of time. | 2387 * an indefinite period of time. |
| 2408 * | 2388 * |
| 2409 * @param timeout the maximum number of milliseconds to wait for an operation
to be available | 2389 * @param timeout the maximum number of milliseconds to wait for an operation
to be available |
| 2410 * before giving up and returning `null` | 2390 * before giving up and returning `null` |
| 2411 * @return the operation that was removed from the queue | 2391 * @return the operation that was removed from the queue |
| 2412 * @throws InterruptedException if the thread on which this method is running
was interrupted | 2392 * @throws InterruptedException if the thread on which this method is running
was interrupted |
| 2413 * while it was waiting for an operation to be added to the queue | 2393 * while it was waiting for an operation to be added to the queue |
| 2414 */ | 2394 */ |
| 2415 IndexOperation dequeue(int timeout) { | 2395 IndexOperation dequeue(int timeout) { |
| 2416 { | 2396 if (_nonQueryOperations.isEmpty && (!_processQueries || _queryOperations.isE
mpty)) { |
| 2417 if (_nonQueryOperations.isEmpty && (!_processQueries || _queryOperations.i
sEmpty)) { | 2397 if (timeout <= 0) { |
| 2418 if (timeout <= 0) { | 2398 return null; |
| 2419 return null; | |
| 2420 } | |
| 2421 waitForOperationAvailable(timeout); | |
| 2422 } | 2399 } |
| 2423 if (!_nonQueryOperations.isEmpty) { | 2400 waitForOperationAvailable(timeout); |
| 2424 return _nonQueryOperations.removeFirst(); | |
| 2425 } | |
| 2426 if (_processQueries && !_queryOperations.isEmpty) { | |
| 2427 return _queryOperations.removeFirst(); | |
| 2428 } | |
| 2429 return null; | |
| 2430 } | 2401 } |
| 2402 if (!_nonQueryOperations.isEmpty) { |
| 2403 return _nonQueryOperations.removeFirst(); |
| 2404 } |
| 2405 if (_processQueries && !_queryOperations.isEmpty) { |
| 2406 return _queryOperations.removeFirst(); |
| 2407 } |
| 2408 return null; |
| 2431 } | 2409 } |
| 2432 | 2410 |
| 2433 /** | 2411 /** |
| 2434 * Add the given operation to the tail of this queue. | 2412 * Add the given operation to the tail of this queue. |
| 2435 * | 2413 * |
| 2436 * @param operation the operation to be added to the queue | 2414 * @param operation the operation to be added to the queue |
| 2437 */ | 2415 */ |
| 2438 void enqueue(IndexOperation operation) { | 2416 void enqueue(IndexOperation operation) { |
| 2439 { | 2417 if (operation is RemoveSourceOperation) { |
| 2440 if (operation is RemoveSourceOperation) { | 2418 Source source = operation.source; |
| 2441 Source source = operation.source; | 2419 removeForSource(source, _nonQueryOperations); |
| 2442 removeForSource(source, _nonQueryOperations); | 2420 removeForSource(source, _queryOperations); |
| 2443 removeForSource(source, _queryOperations); | |
| 2444 } | |
| 2445 if (operation.isQuery) { | |
| 2446 _queryOperations.add(operation); | |
| 2447 } else { | |
| 2448 _nonQueryOperations.add(operation); | |
| 2449 } | |
| 2450 notifyOperationAvailable(); | |
| 2451 } | 2421 } |
| 2422 if (operation.isQuery) { |
| 2423 _queryOperations.add(operation); |
| 2424 } else { |
| 2425 _nonQueryOperations.add(operation); |
| 2426 } |
| 2427 notifyOperationAvailable(); |
| 2452 } | 2428 } |
| 2453 | 2429 |
| 2454 /** | 2430 /** |
| 2455 * Return a list containing all of the operations that are currently on the qu
eue. Modifying this | 2431 * Return a list containing all of the operations that are currently on the qu
eue. Modifying this |
| 2456 * list will not affect the state of the queue. | 2432 * list will not affect the state of the queue. |
| 2457 * | 2433 * |
| 2458 * @return all of the operations that are currently on the queue | 2434 * @return all of the operations that are currently on the queue |
| 2459 */ | 2435 */ |
| 2460 List<IndexOperation> get operations { | 2436 List<IndexOperation> get operations { |
| 2461 List<IndexOperation> operations = []; | 2437 List<IndexOperation> operations = []; |
| 2462 { | 2438 operations.addAll(_nonQueryOperations); |
| 2463 operations.addAll(_nonQueryOperations); | 2439 operations.addAll(_queryOperations); |
| 2464 operations.addAll(_queryOperations); | |
| 2465 } | |
| 2466 return operations; | 2440 return operations; |
| 2467 } | 2441 } |
| 2468 | 2442 |
| 2469 /** | 2443 /** |
| 2470 * Set whether the receiver's [dequeue] method should return query operations. | 2444 * Set whether the receiver's [dequeue] method should return query operations. |
| 2471 * | 2445 * |
| 2472 * @param processQueries `true` if the receiver's [dequeue] method should | 2446 * @param processQueries `true` if the receiver's [dequeue] method should |
| 2473 * return query operations or `false` if query operations should be q
ueued but not | 2447 * return query operations or `false` if query operations should be q
ueued but not |
| 2474 * returned by the receiver's [dequeue] method until this method is c
alled | 2448 * returned by the receiver's [dequeue] method until this method is c
alled |
| 2475 * with a value of `true`. | 2449 * with a value of `true`. |
| 2476 */ | 2450 */ |
| 2477 void set processQueries(bool processQueries) { | 2451 void set processQueries(bool processQueries) { |
| 2478 { | 2452 if (this._processQueries != processQueries) { |
| 2479 if (this._processQueries != processQueries) { | 2453 this._processQueries = processQueries; |
| 2480 this._processQueries = processQueries; | 2454 if (processQueries && !_queryOperations.isEmpty) { |
| 2481 if (processQueries && !_queryOperations.isEmpty) { | 2455 notifyOperationAvailable(); |
| 2482 notifyOperationAvailable(); | |
| 2483 } | |
| 2484 } | 2456 } |
| 2485 } | 2457 } |
| 2486 } | 2458 } |
| 2487 | 2459 |
| 2488 /** | 2460 /** |
| 2489 * Return the number of operations on the queue. | 2461 * Return the number of operations on the queue. |
| 2490 * | 2462 * |
| 2491 * @return the number of operations on the queue | 2463 * @return the number of operations on the queue |
| 2492 */ | 2464 */ |
| 2493 int size() { | 2465 int size() => _nonQueryOperations.length + _queryOperations.length; |
| 2494 { | |
| 2495 return _nonQueryOperations.length + _queryOperations.length; | |
| 2496 } | |
| 2497 } | |
| 2498 | 2466 |
| 2499 void notifyOperationAvailable() { | 2467 void notifyOperationAvailable() { |
| 2500 } | 2468 } |
| 2501 | 2469 |
| 2502 /** | 2470 /** |
| 2503 * Removes operations that should be removed when given [Source] is removed. | 2471 * Removes operations that should be removed when given [Source] is removed. |
| 2504 */ | 2472 */ |
| 2505 void removeForSource(Source source, Queue<IndexOperation> operations) { | 2473 void removeForSource(Source source, Queue<IndexOperation> operations) { |
| 2506 operations.removeWhere((_) => _.removeWhenSourceRemoved(source)); | 2474 operations.removeWhere((_) => _.removeWhenSourceRemoved(source)); |
| 2507 } | 2475 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2614 * @param indexStore the index store against which this operation is being run | 2582 * @param indexStore the index store against which this operation is being run |
| 2615 * @param context the [AnalysisContext] to remove | 2583 * @param context the [AnalysisContext] to remove |
| 2616 */ | 2584 */ |
| 2617 RemoveContextOperation(IndexStore indexStore, this.context) { | 2585 RemoveContextOperation(IndexStore indexStore, this.context) { |
| 2618 this._indexStore = indexStore; | 2586 this._indexStore = indexStore; |
| 2619 } | 2587 } |
| 2620 | 2588 |
| 2621 bool get isQuery => false; | 2589 bool get isQuery => false; |
| 2622 | 2590 |
| 2623 void performOperation() { | 2591 void performOperation() { |
| 2624 { | 2592 _indexStore.removeContext(context); |
| 2625 _indexStore.removeContext(context); | |
| 2626 } | |
| 2627 } | 2593 } |
| 2628 | 2594 |
| 2629 bool removeWhenSourceRemoved(Source source) => false; | 2595 bool removeWhenSourceRemoved(Source source) => false; |
| 2630 | 2596 |
| 2631 String toString() => "RemoveContext(${context})"; | 2597 String toString() => "RemoveContext(${context})"; |
| 2632 } | 2598 } |
| 2633 | 2599 |
| 2634 /** | 2600 /** |
| 2635 * Instances of the [IndexHtmlUnitOperation] implement an operation that adds da
ta to the | 2601 * Instances of the [IndexHtmlUnitOperation] implement an operation that adds da
ta to the |
| 2636 * index based on the resolved [HtmlUnit]. | 2602 * index based on the resolved [HtmlUnit]. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2676 } | 2642 } |
| 2677 | 2643 |
| 2678 /** | 2644 /** |
| 2679 * @return the [Source] to be indexed. | 2645 * @return the [Source] to be indexed. |
| 2680 */ | 2646 */ |
| 2681 Source get source => _source; | 2647 Source get source => _source; |
| 2682 | 2648 |
| 2683 bool get isQuery => false; | 2649 bool get isQuery => false; |
| 2684 | 2650 |
| 2685 void performOperation() { | 2651 void performOperation() { |
| 2686 { | 2652 try { |
| 2687 try { | 2653 bool mayIndex = _indexStore.aboutToIndex2(_context, _htmlElement); |
| 2688 bool mayIndex = _indexStore.aboutToIndex2(_context, _htmlElement); | 2654 if (!mayIndex) { |
| 2689 if (!mayIndex) { | 2655 return; |
| 2690 return; | |
| 2691 } | |
| 2692 AngularHtmlIndexContributor contributor = new AngularHtmlIndexContributo
r(_indexStore); | |
| 2693 unit.accept(contributor); | |
| 2694 } catch (exception) { | |
| 2695 AnalysisEngine.instance.logger.logError2("Could not index ${unit.element
.location}", exception); | |
| 2696 } | 2656 } |
| 2657 AngularHtmlIndexContributor contributor = new AngularHtmlIndexContributor(
_indexStore); |
| 2658 unit.accept(contributor); |
| 2659 } catch (exception) { |
| 2660 AnalysisEngine.instance.logger.logError2("Could not index ${unit.element.l
ocation}", exception); |
| 2697 } | 2661 } |
| 2698 } | 2662 } |
| 2699 | 2663 |
| 2700 bool removeWhenSourceRemoved(Source source) => this._source == source; | 2664 bool removeWhenSourceRemoved(Source source) => this._source == source; |
| 2701 | 2665 |
| 2702 String toString() => "IndexHtmlUnitOperation(${_source.fullName})"; | 2666 String toString() => "IndexHtmlUnitOperation(${_source.fullName})"; |
| 2703 } | 2667 } |
| 2704 | 2668 |
| 2705 /** | 2669 /** |
| 2706 * Instances of the class <code>Location</code> represent a location related to
an element. The | 2670 * Instances of the class <code>Location</code> represent a location related to
an element. The |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2777 * relationship with a specified element. | 2741 * relationship with a specified element. |
| 2778 */ | 2742 */ |
| 2779 GetRelationshipsOperation(IndexStore indexStore, this.element, this.relationsh
ip, this.callback) { | 2743 GetRelationshipsOperation(IndexStore indexStore, this.element, this.relationsh
ip, this.callback) { |
| 2780 this._indexStore = indexStore; | 2744 this._indexStore = indexStore; |
| 2781 } | 2745 } |
| 2782 | 2746 |
| 2783 bool get isQuery => true; | 2747 bool get isQuery => true; |
| 2784 | 2748 |
| 2785 void performOperation() { | 2749 void performOperation() { |
| 2786 List<Location> locations; | 2750 List<Location> locations; |
| 2787 { | 2751 locations = _indexStore.getRelationships(element, relationship); |
| 2788 locations = _indexStore.getRelationships(element, relationship); | |
| 2789 } | |
| 2790 callback.hasRelationships(element, relationship, locations); | 2752 callback.hasRelationships(element, relationship, locations); |
| 2791 } | 2753 } |
| 2792 | 2754 |
| 2793 bool removeWhenSourceRemoved(Source source) => false; | 2755 bool removeWhenSourceRemoved(Source source) => false; |
| 2794 | 2756 |
| 2795 String toString() => "GetRelationships(${element}, ${relationship})"; | 2757 String toString() => "GetRelationships(${element}, ${relationship})"; |
| 2796 } | 2758 } |
| 2797 | 2759 |
| 2798 /** | 2760 /** |
| 2799 * [Location] with attached data. | 2761 * [Location] with attached data. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2818 * element are available. For example, if the element is a field and the relat
ionship is the | 2780 * element are available. For example, if the element is a field and the relat
ionship is the |
| 2819 * is-referenced-by relationship, then this method will be invoked with each l
ocation at which the | 2781 * is-referenced-by relationship, then this method will be invoked with each l
ocation at which the |
| 2820 * field is referenced. | 2782 * field is referenced. |
| 2821 * | 2783 * |
| 2822 * @param element the [Element] that has the relationship with the locations | 2784 * @param element the [Element] that has the relationship with the locations |
| 2823 * @param relationship the relationship between the given element and the loca
tions | 2785 * @param relationship the relationship between the given element and the loca
tions |
| 2824 * @param locations the locations that were found | 2786 * @param locations the locations that were found |
| 2825 */ | 2787 */ |
| 2826 void hasRelationships(Element element, Relationship relationship, List<Locatio
n> locations); | 2788 void hasRelationships(Element element, Relationship relationship, List<Locatio
n> locations); |
| 2827 } | 2789 } |
| OLD | NEW |