| 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:math" as math; | 10 import "dart:math" as math; |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 * | 542 * |
| 543 * @param source the source whose line information is to be returned | 543 * @param source the source whose line information is to be returned |
| 544 * @return the line information for the given source | 544 * @return the line information for the given source |
| 545 * @throws AnalysisException if the line information could not be determined b
ecause the analysis | 545 * @throws AnalysisException if the line information could not be determined b
ecause the analysis |
| 546 * could not be performed | 546 * could not be performed |
| 547 * See [getLineInfo]. | 547 * See [getLineInfo]. |
| 548 */ | 548 */ |
| 549 LineInfo computeLineInfo(Source source); | 549 LineInfo computeLineInfo(Source source); |
| 550 | 550 |
| 551 /** | 551 /** |
| 552 * Return a future which will be completed with the fully resolved AST for a |
| 553 * single compilation unit within the given library, once that AST is up to |
| 554 * date. |
| 555 * |
| 556 * If the resolved AST can't be computed for some reason, the future will be |
| 557 * completed with an error. One possible error is AnalysisNotScheduledError, |
| 558 * which means that the resolved AST can't be computed because the given |
| 559 * source file is not scheduled to be analyzed within the context of the |
| 560 * given library. |
| 561 */ |
| 562 CancelableFuture<CompilationUnit> |
| 563 computeResolvedCompilationUnitAsync(Source source, Source librarySource); |
| 564 |
| 565 /** |
| 552 * Notifies the context that the client is going to stop using this context. | 566 * Notifies the context that the client is going to stop using this context. |
| 553 */ | 567 */ |
| 554 void dispose(); | 568 void dispose(); |
| 555 | 569 |
| 556 /** | 570 /** |
| 557 * Return `true` if the given source exists. | 571 * Return `true` if the given source exists. |
| 558 * | 572 * |
| 559 * This method should be used rather than the method [Source.exists] because c
ontexts can | 573 * This method should be used rather than the method [Source.exists] because c
ontexts can |
| 560 * have local overrides of the content of a source that the source is not awar
e of and a source | 574 * have local overrides of the content of a source that the source is not awar
e of and a source |
| 561 * with local content is considered to exist even if there is no file on disk. | 575 * with local content is considered to exist even if there is no file on disk. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 * @param unitSource the source of the compilation unit | 756 * @param unitSource the source of the compilation unit |
| 743 * @param librarySource the source of the defining compilation unit of the lib
rary containing the | 757 * @param librarySource the source of the defining compilation unit of the lib
rary containing the |
| 744 * compilation unit | 758 * compilation unit |
| 745 * @return a fully resolved AST for the compilation unit | 759 * @return a fully resolved AST for the compilation unit |
| 746 * See [resolveCompilationUnit]. | 760 * See [resolveCompilationUnit]. |
| 747 */ | 761 */ |
| 748 CompilationUnit getResolvedCompilationUnit2(Source unitSource, | 762 CompilationUnit getResolvedCompilationUnit2(Source unitSource, |
| 749 Source librarySource); | 763 Source librarySource); |
| 750 | 764 |
| 751 /** | 765 /** |
| 752 * Return a future which will be completed with the fully resolved AST for a | |
| 753 * single compilation unit within the given library, once that AST is up to | |
| 754 * date. | |
| 755 * | |
| 756 * If the resolved AST can't be computed for some reason, the future will be | |
| 757 * completed with an error. One possible error is AnalysisNotScheduledError, | |
| 758 * which means that the resolved AST can't be computed because the given | |
| 759 * source file is not scheduled to be analyzed within the context of the | |
| 760 * given library. | |
| 761 */ | |
| 762 CancelableFuture<CompilationUnit> | |
| 763 getResolvedCompilationUnitFuture(Source source, Source librarySource); | |
| 764 | |
| 765 /** | |
| 766 * Return a fully resolved HTML unit, or `null` if the resolved unit is not al
ready | 766 * Return a fully resolved HTML unit, or `null` if the resolved unit is not al
ready |
| 767 * computed. | 767 * computed. |
| 768 * | 768 * |
| 769 * @param htmlSource the source of the HTML unit | 769 * @param htmlSource the source of the HTML unit |
| 770 * @return a fully resolved HTML unit | 770 * @return a fully resolved HTML unit |
| 771 * See [resolveHtmlUnit]. | 771 * See [resolveHtmlUnit]. |
| 772 */ | 772 */ |
| 773 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource); | 773 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource); |
| 774 | 774 |
| 775 /** | 775 /** |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | 1731 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); |
| 1732 CompilationUnit unit = dartEntry.resolvableCompilationUnit; | 1732 CompilationUnit unit = dartEntry.resolvableCompilationUnit; |
| 1733 if (unit == null) { | 1733 if (unit == null) { |
| 1734 throw new AnalysisException( | 1734 throw new AnalysisException( |
| 1735 "Internal error: computeResolvableCompilationUnit could not parse ${so
urce.fullName}", | 1735 "Internal error: computeResolvableCompilationUnit could not parse ${so
urce.fullName}", |
| 1736 new CaughtException(dartEntry.exception, null)); | 1736 new CaughtException(dartEntry.exception, null)); |
| 1737 } | 1737 } |
| 1738 return unit; | 1738 return unit; |
| 1739 } | 1739 } |
| 1740 | 1740 |
| 1741 @override |
| 1742 CancelableFuture<CompilationUnit> |
| 1743 computeResolvedCompilationUnitAsync(Source unitSource, Source librarySourc
e) { |
| 1744 return new _AnalysisFutureHelper<CompilationUnit>( |
| 1745 this).computeAsync(unitSource, (SourceEntry sourceEntry) { |
| 1746 if (sourceEntry is DartEntry) { |
| 1747 if (sourceEntry.getStateInLibrary( |
| 1748 DartEntry.RESOLVED_UNIT, |
| 1749 librarySource) == |
| 1750 CacheState.ERROR) { |
| 1751 throw sourceEntry.exception; |
| 1752 } |
| 1753 return sourceEntry.getValueInLibrary( |
| 1754 DartEntry.RESOLVED_UNIT, |
| 1755 librarySource); |
| 1756 } |
| 1757 throw new AnalysisNotScheduledError(); |
| 1758 }); |
| 1759 } |
| 1760 |
| 1741 /** | 1761 /** |
| 1742 * Create an analysis cache based on the given source factory. | 1762 * Create an analysis cache based on the given source factory. |
| 1743 * | 1763 * |
| 1744 * @param factory the source factory containing the information needed to crea
te the cache | 1764 * @param factory the source factory containing the information needed to crea
te the cache |
| 1745 * @return the cache that was created | 1765 * @return the cache that was created |
| 1746 */ | 1766 */ |
| 1747 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { | 1767 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { |
| 1748 if (factory == null) { | 1768 if (factory == null) { |
| 1749 return new AnalysisCache(<CachePartition>[_privatePartition]); | 1769 return new AnalysisCache(<CachePartition>[_privatePartition]); |
| 1750 } | 1770 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2075 SourceEntry sourceEntry = getReadableSourceEntryOrNull(unitSource); | 2095 SourceEntry sourceEntry = getReadableSourceEntryOrNull(unitSource); |
| 2076 if (sourceEntry is DartEntry) { | 2096 if (sourceEntry is DartEntry) { |
| 2077 return sourceEntry.getValueInLibrary( | 2097 return sourceEntry.getValueInLibrary( |
| 2078 DartEntry.RESOLVED_UNIT, | 2098 DartEntry.RESOLVED_UNIT, |
| 2079 librarySource); | 2099 librarySource); |
| 2080 } | 2100 } |
| 2081 return null; | 2101 return null; |
| 2082 } | 2102 } |
| 2083 | 2103 |
| 2084 @override | 2104 @override |
| 2085 CancelableFuture<CompilationUnit> | |
| 2086 getResolvedCompilationUnitFuture(Source unitSource, Source librarySource)
{ | |
| 2087 return new _AnalysisFutureHelper<CompilationUnit>( | |
| 2088 this).getFuture(unitSource, (SourceEntry sourceEntry) { | |
| 2089 if (sourceEntry is DartEntry) { | |
| 2090 if (sourceEntry.getStateInLibrary( | |
| 2091 DartEntry.RESOLVED_UNIT, | |
| 2092 librarySource) == | |
| 2093 CacheState.ERROR) { | |
| 2094 throw sourceEntry.exception; | |
| 2095 } | |
| 2096 return sourceEntry.getValueInLibrary( | |
| 2097 DartEntry.RESOLVED_UNIT, | |
| 2098 librarySource); | |
| 2099 } | |
| 2100 throw new AnalysisNotScheduledError(); | |
| 2101 }); | |
| 2102 } | |
| 2103 | |
| 2104 @override | |
| 2105 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { | 2105 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 2106 SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource); | 2106 SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource); |
| 2107 if (sourceEntry is HtmlEntry) { | 2107 if (sourceEntry is HtmlEntry) { |
| 2108 HtmlEntry htmlEntry = sourceEntry; | 2108 HtmlEntry htmlEntry = sourceEntry; |
| 2109 return htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT); | 2109 return htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT); |
| 2110 } | 2110 } |
| 2111 return null; | 2111 return null; |
| 2112 } | 2112 } |
| 2113 | 2113 |
| 2114 @override | 2114 @override |
| (...skipping 12230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14345 * exception, the future will fail with that exception. | 14345 * exception, the future will fail with that exception. |
| 14346 * | 14346 * |
| 14347 * If the [computeValue] still returns null after there is no further | 14347 * If the [computeValue] still returns null after there is no further |
| 14348 * analysis to be done for [source], then the future will be completed with | 14348 * analysis to be done for [source], then the future will be completed with |
| 14349 * the error AnalysisNotScheduledError. | 14349 * the error AnalysisNotScheduledError. |
| 14350 * | 14350 * |
| 14351 * Since [computeValue] will be called while the state of analysis is being | 14351 * Since [computeValue] will be called while the state of analysis is being |
| 14352 * updated, it should be free of side effects so that it doesn't cause | 14352 * updated, it should be free of side effects so that it doesn't cause |
| 14353 * reentrant changes to the analysis state. | 14353 * reentrant changes to the analysis state. |
| 14354 */ | 14354 */ |
| 14355 CancelableFuture<T> getFuture(Source source, T | 14355 CancelableFuture<T> computeAsync(Source source, T |
| 14356 computeValue(SourceEntry sourceEntry)) { | 14356 computeValue(SourceEntry sourceEntry)) { |
| 14357 SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source); | 14357 SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source); |
| 14358 if (sourceEntry == null) { | 14358 if (sourceEntry == null) { |
| 14359 return new CancelableFuture.error(new AnalysisNotScheduledError()); | 14359 return new CancelableFuture.error(new AnalysisNotScheduledError()); |
| 14360 } | 14360 } |
| 14361 PendingFuture pendingFuture = | 14361 PendingFuture pendingFuture = |
| 14362 new PendingFuture<T>(_context, source, computeValue); | 14362 new PendingFuture<T>(_context, source, computeValue); |
| 14363 if (!pendingFuture.evaluate(sourceEntry)) { | 14363 if (!pendingFuture.evaluate(sourceEntry)) { |
| 14364 _context._pendingFutureSources.putIfAbsent( | 14364 _context._pendingFutureSources.putIfAbsent( |
| 14365 source, | 14365 source, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14414 | 14414 |
| 14415 @override | 14415 @override |
| 14416 Object visitPolymerTagDartElement(PolymerTagDartElement element) { | 14416 Object visitPolymerTagDartElement(PolymerTagDartElement element) { |
| 14417 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { | 14417 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { |
| 14418 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( | 14418 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( |
| 14419 element as PolymerTagDartElementImpl); | 14419 element as PolymerTagDartElementImpl); |
| 14420 } | 14420 } |
| 14421 return null; | 14421 return null; |
| 14422 } | 14422 } |
| 14423 } | 14423 } |
| OLD | NEW |