Chromium Code Reviews| 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<ResultComputedEvent> 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_NO_CONSTANTS]. | |
| 785 * | |
| 786 * 2. For explicit sources: | |
| 787 * [RESOLVED_UNIT] | |
| 788 * [DART_ERRORS]. | |
| 789 * | |
| 790 * 3. For explicit and implicit library sources: | |
| 791 * [LIBRARY_ELEMENT]. | |
| 770 */ | 792 */ |
| 771 AnalysisResult performAnalysisTask(); | 793 AnalysisResult performAnalysisTask(); |
| 772 | 794 |
| 773 /** | 795 /** |
| 774 * Remove the given [listener] from the list of objects that are to be | 796 * Remove the given [listener] from the list of objects that are to be |
| 775 * notified when various analysis results are produced in this context. | 797 * notified when various analysis results are produced in this context. |
| 776 */ | 798 */ |
| 777 void removeListener(AnalysisListener listener); | 799 void removeListener(AnalysisListener listener); |
| 778 | 800 |
| 779 /** | 801 /** |
| (...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2200 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 2222 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
| 2201 if (sourceEntry is DartEntry) { | 2223 if (sourceEntry is DartEntry) { |
| 2202 DartEntry dartEntry = sourceEntry; | 2224 DartEntry dartEntry = sourceEntry; |
| 2203 return !dartEntry.getValue(DartEntry.IS_CLIENT) && | 2225 return !dartEntry.getValue(DartEntry.IS_CLIENT) && |
| 2204 dartEntry.getValue(DartEntry.IS_LAUNCHABLE); | 2226 dartEntry.getValue(DartEntry.IS_LAUNCHABLE); |
| 2205 } | 2227 } |
| 2206 return false; | 2228 return false; |
| 2207 } | 2229 } |
| 2208 | 2230 |
| 2209 @override | 2231 @override |
| 2232 Stream<ResultComputedEvent> onResultComputed(ResultDescriptor descriptor) { | |
| 2233 throw new NotImplementedException('In not task-based AnalysisContext.'); | |
| 2234 } | |
| 2235 | |
| 2236 @override | |
| 2210 CompilationUnit parseCompilationUnit(Source source) => | 2237 CompilationUnit parseCompilationUnit(Source source) => |
| 2211 _getDartParseData2(source, DartEntry.PARSED_UNIT, null); | 2238 _getDartParseData2(source, DartEntry.PARSED_UNIT, null); |
| 2212 | 2239 |
| 2213 @override | 2240 @override |
| 2214 ht.HtmlUnit parseHtmlUnit(Source source) => | 2241 ht.HtmlUnit parseHtmlUnit(Source source) => |
| 2215 _getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null); | 2242 _getHtmlParseData(source, HtmlEntry.PARSED_UNIT, null); |
| 2216 | 2243 |
| 2217 @override | 2244 @override |
| 2218 AnalysisResult performAnalysisTask() { | 2245 AnalysisResult performAnalysisTask() { |
| 2219 if (_TRACE_PERFORM_TASK) { | 2246 if (_TRACE_PERFORM_TASK) { |
| (...skipping 8529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10749 // | 10776 // |
| 10750 _resolutionErrors = errorListener.getErrorsForSource(source); | 10777 _resolutionErrors = errorListener.getErrorsForSource(source); |
| 10751 // | 10778 // |
| 10752 // Remember the resolved unit. | 10779 // Remember the resolved unit. |
| 10753 // | 10780 // |
| 10754 _resolvedUnit = _unit; | 10781 _resolvedUnit = _unit; |
| 10755 } | 10782 } |
| 10756 } | 10783 } |
| 10757 | 10784 |
| 10758 /** | 10785 /** |
| 10786 * [ResultComputedEvent] describes a value computed for a [ResultDescriptor]. | |
| 10787 */ | |
| 10788 class ResultComputedEvent<V> { | |
|
Brian Wilkerson
2015/06/11 16:44:44
Perhaps "ComputedResult"?
scheglov
2015/06/11 17:43:25
Done.
| |
| 10789 /** | |
| 10790 * The context in which the value was computed. | |
| 10791 */ | |
| 10792 final AnalysisContext context; | |
| 10793 | |
| 10794 /** | |
| 10795 * The descriptor of the result which was computed. | |
| 10796 */ | |
| 10797 final ResultDescriptor<V> descriptor; | |
| 10798 | |
| 10799 /** | |
| 10800 * The target for which the result was computed. | |
| 10801 */ | |
| 10802 final AnalysisTarget target; | |
| 10803 | |
| 10804 /** | |
| 10805 * The computed value. | |
| 10806 */ | |
| 10807 final V value; | |
| 10808 | |
| 10809 ResultComputedEvent(this.context, this.descriptor, this.target, this.value); | |
| 10810 | |
| 10811 @override | |
| 10812 String toString() => '$descriptor of $target in $context'; | |
| 10813 } | |
| 10814 | |
| 10815 /** | |
| 10759 * The priority of data in the cache in terms of the desirability of retaining | 10816 * The priority of data in the cache in terms of the desirability of retaining |
| 10760 * some specified data about a specified source. | 10817 * some specified data about a specified source. |
| 10761 */ | 10818 */ |
| 10762 class RetentionPriority extends Enum<RetentionPriority> { | 10819 class RetentionPriority extends Enum<RetentionPriority> { |
| 10763 /** | 10820 /** |
| 10764 * A priority indicating that a given piece of data can be removed from the | 10821 * A priority indicating that a given piece of data can be removed from the |
| 10765 * cache without reservation. | 10822 * cache without reservation. |
| 10766 */ | 10823 */ |
| 10767 static const RetentionPriority LOW = const RetentionPriority('LOW', 0); | 10824 static const RetentionPriority LOW = const RetentionPriority('LOW', 0); |
| 10768 | 10825 |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11713 PendingFuture pendingFuture = | 11770 PendingFuture pendingFuture = |
| 11714 new PendingFuture<T>(_context, source, computeValue); | 11771 new PendingFuture<T>(_context, source, computeValue); |
| 11715 if (!pendingFuture.evaluate(sourceEntry)) { | 11772 if (!pendingFuture.evaluate(sourceEntry)) { |
| 11716 _context._pendingFutureSources | 11773 _context._pendingFutureSources |
| 11717 .putIfAbsent(source, () => <PendingFuture>[]) | 11774 .putIfAbsent(source, () => <PendingFuture>[]) |
| 11718 .add(pendingFuture); | 11775 .add(pendingFuture); |
| 11719 } | 11776 } |
| 11720 return pendingFuture.future; | 11777 return pendingFuture.future; |
| 11721 } | 11778 } |
| 11722 } | 11779 } |
| OLD | NEW |