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; | 8 library engine; |
9 | 9 |
10 import 'dart:async'; | 10 import 'dart:async'; |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 * reference 'dart:html', either directly or indirectly). | 735 * reference 'dart:html', either directly or indirectly). |
736 * | 736 * |
737 * <b>Note:</b> In addition to the expected case of returning `false` if the | 737 * <b>Note:</b> In addition to the expected case of returning `false` if the |
738 * source is known to be a library that cannot be run on the server, this | 738 * source is known to be a library that cannot be run on the server, this |
739 * method will also return `false` if the source is not known to be a library | 739 * method will also return `false` if the source is not known to be a library |
740 * or if we do not know whether it can be run on the server. | 740 * or if we do not know whether it can be run on the server. |
741 */ | 741 */ |
742 bool isServerLibrary(Source librarySource); | 742 bool isServerLibrary(Source librarySource); |
743 | 743 |
744 /** | 744 /** |
| 745 * Return the stream that is notified when a new value for the given |
| 746 * [descriptor] is computed. |
| 747 */ |
| 748 Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor); |
| 749 |
| 750 /** |
745 * Parse the content of the given [source] to produce an AST structure. The | 751 * Parse the content of the given [source] to produce an AST structure. The |
746 * resulting AST structure may or may not be resolved, and may have a slightly | 752 * resulting AST structure may or may not be resolved, and may have a slightly |
747 * different structure depending upon whether it is resolved. | 753 * different structure depending upon whether it is resolved. |
748 * | 754 * |
749 * Throws an [AnalysisException] if the analysis could not be performed | 755 * Throws an [AnalysisException] if the analysis could not be performed |
750 * | 756 * |
751 * <b>Note:</b> This method cannot be used in an async environment. | 757 * <b>Note:</b> This method cannot be used in an async environment. |
752 */ | 758 */ |
753 CompilationUnit parseCompilationUnit(Source source); | 759 CompilationUnit parseCompilationUnit(Source source); |
754 | 760 |
755 /** | 761 /** |
756 * Parse a single HTML [source] to produce an AST structure. The resulting | 762 * Parse a single HTML [source] to produce an AST structure. The resulting |
757 * HTML AST structure may or may not be resolved, and may have a slightly | 763 * HTML AST structure may or may not be resolved, and may have a slightly |
758 * different structure depending upon whether it is resolved. | 764 * different structure depending upon whether it is resolved. |
759 * | 765 * |
760 * Throws an [AnalysisException] if the analysis could not be performed | 766 * Throws an [AnalysisException] if the analysis could not be performed |
761 * | 767 * |
762 * <b>Note:</b> This method cannot be used in an async environment. | 768 * <b>Note:</b> This method cannot be used in an async environment. |
763 */ | 769 */ |
764 ht.HtmlUnit parseHtmlUnit(Source source); | 770 ht.HtmlUnit parseHtmlUnit(Source source); |
765 | 771 |
766 /** | 772 /** |
767 * Perform the next unit of work required to keep the analysis results | 773 * Perform the next unit of work required to keep the analysis results |
768 * up-to-date and return information about the consequent changes to the | 774 * up-to-date and return information about the consequent changes to the |
769 * analysis results. This method can be long running. | 775 * analysis results. This method can be long running. |
| 776 * |
| 777 * The implementation that uses the task model notifies subscribers of |
| 778 * [onResultComputed] about computed results. |
| 779 * |
| 780 * The following results are computed for Dart sources. |
| 781 * |
| 782 * 1. For explicit and implicit sources: |
| 783 * [PARSED_UNIT] |
| 784 * [RESOLVED_UNIT] |
| 785 * |
| 786 * 2. For explicit sources: |
| 787 * [DART_ERRORS]. |
| 788 * |
| 789 * 3. For explicit and implicit library sources: |
| 790 * [LIBRARY_ELEMENT]. |
770 */ | 791 */ |
771 AnalysisResult performAnalysisTask(); | 792 AnalysisResult performAnalysisTask(); |
772 | 793 |
773 /** | 794 /** |
774 * Remove the given [listener] from the list of objects that are to be | 795 * Remove the given [listener] from the list of objects that are to be |
775 * notified when various analysis results are produced in this context. | 796 * notified when various analysis results are produced in this context. |
776 */ | 797 */ |
777 void removeListener(AnalysisListener listener); | 798 void removeListener(AnalysisListener listener); |
778 | 799 |
779 /** | 800 /** |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 2221 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
2201 if (sourceEntry is DartEntry) { | 2222 if (sourceEntry is DartEntry) { |
2202 DartEntry dartEntry = sourceEntry; | 2223 DartEntry dartEntry = sourceEntry; |
2203 return !dartEntry.getValue(DartEntry.IS_CLIENT) && | 2224 return !dartEntry.getValue(DartEntry.IS_CLIENT) && |
2204 dartEntry.getValue(DartEntry.IS_LAUNCHABLE); | 2225 dartEntry.getValue(DartEntry.IS_LAUNCHABLE); |
2205 } | 2226 } |
2206 return false; | 2227 return false; |
2207 } | 2228 } |
2208 | 2229 |
2209 @override | 2230 @override |
| 2231 Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor) { |
| 2232 throw new NotImplementedException('In not task-based AnalysisContext.'); |
| 2233 } |
| 2234 |
| 2235 @override |
2210 CompilationUnit parseCompilationUnit(Source source) => | 2236 CompilationUnit parseCompilationUnit(Source source) => |
2211 _getDartParseData2(source, DartEntry.PARSED_UNIT, null); | 2237 _getDartParseData2(source, DartEntry.PARSED_UNIT, null); |
2212 | 2238 |
2213 @override | 2239 @override |
2214 ht.HtmlUnit parseHtmlUnit(Source source) => | 2240 ht.HtmlUnit parseHtmlUnit(Source source) => |
2215 _getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null); | 2241 _getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null); |
2216 | 2242 |
2217 @override | 2243 @override |
2218 AnalysisResult performAnalysisTask() { | 2244 AnalysisResult performAnalysisTask() { |
2219 if (_TRACE_PERFORM_TASK) { | 2245 if (_TRACE_PERFORM_TASK) { |
(...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5722 /** | 5748 /** |
5723 * The partition manager being used to manage the shared partitions. | 5749 * The partition manager being used to manage the shared partitions. |
5724 */ | 5750 */ |
5725 final newContext.PartitionManager partitionManager_new = | 5751 final newContext.PartitionManager partitionManager_new = |
5726 new newContext.PartitionManager(); | 5752 new newContext.PartitionManager(); |
5727 | 5753 |
5728 /** | 5754 /** |
5729 * A flag indicating whether the (new) task model should be used to perform | 5755 * A flag indicating whether the (new) task model should be used to perform |
5730 * analysis. | 5756 * analysis. |
5731 */ | 5757 */ |
5732 bool useTaskModel = false; | 5758 bool useTaskModel = true; |
5733 | 5759 |
5734 /** | 5760 /** |
5735 * The task manager used to manage the tasks used to analyze code. | 5761 * The task manager used to manage the tasks used to analyze code. |
5736 */ | 5762 */ |
5737 TaskManager _taskManager; | 5763 TaskManager _taskManager; |
5738 | 5764 |
5739 AnalysisEngine._(); | 5765 AnalysisEngine._(); |
5740 | 5766 |
5741 /** | 5767 /** |
5742 * Return the instrumentation service that is to be used by this analysis | 5768 * Return the instrumentation service that is to be used by this analysis |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7176 * content of a source. The [contents] is the new contents of the source. The | 7202 * content of a source. The [contents] is the new contents of the source. The |
7177 * [offse] ist the offset into the current contents. The [oldLength] is the | 7203 * [offse] ist the offset into the current contents. The [oldLength] is the |
7178 * number of characters in the original contents that were replaced. The | 7204 * number of characters in the original contents that were replaced. The |
7179 * [newLength] is the number of characters in the replacement text. | 7205 * [newLength] is the number of characters in the replacement text. |
7180 */ | 7206 */ |
7181 ChangeSet_ContentChange( | 7207 ChangeSet_ContentChange( |
7182 this.contents, this.offset, this.oldLength, this.newLength); | 7208 this.contents, this.offset, this.oldLength, this.newLength); |
7183 } | 7209 } |
7184 | 7210 |
7185 /** | 7211 /** |
| 7212 * [ComputedResult] describes a value computed for a [ResultDescriptor]. |
| 7213 */ |
| 7214 class ComputedResult<V> { |
| 7215 /** |
| 7216 * The context in which the value was computed. |
| 7217 */ |
| 7218 final AnalysisContext context; |
| 7219 |
| 7220 /** |
| 7221 * The descriptor of the result which was computed. |
| 7222 */ |
| 7223 final ResultDescriptor<V> descriptor; |
| 7224 |
| 7225 /** |
| 7226 * The target for which the result was computed. |
| 7227 */ |
| 7228 final AnalysisTarget target; |
| 7229 |
| 7230 /** |
| 7231 * The computed value. |
| 7232 */ |
| 7233 final V value; |
| 7234 |
| 7235 ComputedResult(this.context, this.descriptor, this.target, this.value); |
| 7236 |
| 7237 @override |
| 7238 String toString() => '$descriptor of $target in $context'; |
| 7239 } |
| 7240 |
| 7241 /** |
7186 * A pair containing a library and a list of the (source, entry) pairs for | 7242 * A pair containing a library and a list of the (source, entry) pairs for |
7187 * compilation units in the library. | 7243 * compilation units in the library. |
7188 */ | 7244 */ |
7189 class CycleBuilder_LibraryPair { | 7245 class CycleBuilder_LibraryPair { |
7190 /** | 7246 /** |
7191 * The library containing the compilation units. | 7247 * The library containing the compilation units. |
7192 */ | 7248 */ |
7193 ResolvableLibrary library; | 7249 ResolvableLibrary library; |
7194 | 7250 |
7195 /** | 7251 /** |
(...skipping 4517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11713 PendingFuture pendingFuture = | 11769 PendingFuture pendingFuture = |
11714 new PendingFuture<T>(_context, source, computeValue); | 11770 new PendingFuture<T>(_context, source, computeValue); |
11715 if (!pendingFuture.evaluate(sourceEntry)) { | 11771 if (!pendingFuture.evaluate(sourceEntry)) { |
11716 _context._pendingFutureSources | 11772 _context._pendingFutureSources |
11717 .putIfAbsent(source, () => <PendingFuture>[]) | 11773 .putIfAbsent(source, () => <PendingFuture>[]) |
11718 .add(pendingFuture); | 11774 .add(pendingFuture); |
11719 } | 11775 } |
11720 return pendingFuture.future; | 11776 return pendingFuture.future; |
11721 } | 11777 } |
11722 } | 11778 } |
OLD | NEW |