Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 809793002: Improve nomenclature of new AnalysisContext async method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/engine.dart
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 78188788b51a36e4fc4081dcf77f2d94ff7df34c..d62d3a7362b0a8785794ea3c9d1ce3a2eaaff5a4 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -549,6 +549,20 @@ abstract class AnalysisContext {
LineInfo computeLineInfo(Source source);
/**
+ * Return a future which will be completed with the fully resolved AST for a
+ * single compilation unit within the given library, once that AST is up to
+ * date.
+ *
+ * If the resolved AST can't be computed for some reason, the future will be
+ * completed with an error. One possible error is AnalysisNotScheduledError,
+ * which means that the resolved AST can't be computed because the given
+ * source file is not scheduled to be analyzed within the context of the
+ * given library.
+ */
+ CancelableFuture<CompilationUnit>
+ computeResolvedCompilationUnitAsync(Source source, Source librarySource);
+
+ /**
* Notifies the context that the client is going to stop using this context.
*/
void dispose();
@@ -749,20 +763,6 @@ abstract class AnalysisContext {
Source librarySource);
/**
- * Return a future which will be completed with the fully resolved AST for a
- * single compilation unit within the given library, once that AST is up to
- * date.
- *
- * If the resolved AST can't be computed for some reason, the future will be
- * completed with an error. One possible error is AnalysisNotScheduledError,
- * which means that the resolved AST can't be computed because the given
- * source file is not scheduled to be analyzed within the context of the
- * given library.
- */
- CancelableFuture<CompilationUnit>
- getResolvedCompilationUnitFuture(Source source, Source librarySource);
-
- /**
* Return a fully resolved HTML unit, or `null` if the resolved unit is not already
* computed.
*
@@ -1738,6 +1738,26 @@ class AnalysisContextImpl implements InternalAnalysisContext {
return unit;
}
+ @override
+ CancelableFuture<CompilationUnit>
+ computeResolvedCompilationUnitAsync(Source unitSource, Source librarySource) {
+ return new _AnalysisFutureHelper<CompilationUnit>(
+ this).computeAsync(unitSource, (SourceEntry sourceEntry) {
+ if (sourceEntry is DartEntry) {
+ if (sourceEntry.getStateInLibrary(
+ DartEntry.RESOLVED_UNIT,
+ librarySource) ==
+ CacheState.ERROR) {
+ throw sourceEntry.exception;
+ }
+ return sourceEntry.getValueInLibrary(
+ DartEntry.RESOLVED_UNIT,
+ librarySource);
+ }
+ throw new AnalysisNotScheduledError();
+ });
+ }
+
/**
* Create an analysis cache based on the given source factory.
*
@@ -2082,26 +2102,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
- CancelableFuture<CompilationUnit>
- getResolvedCompilationUnitFuture(Source unitSource, Source librarySource) {
- return new _AnalysisFutureHelper<CompilationUnit>(
- this).getFuture(unitSource, (SourceEntry sourceEntry) {
- if (sourceEntry is DartEntry) {
- if (sourceEntry.getStateInLibrary(
- DartEntry.RESOLVED_UNIT,
- librarySource) ==
- CacheState.ERROR) {
- throw sourceEntry.exception;
- }
- return sourceEntry.getValueInLibrary(
- DartEntry.RESOLVED_UNIT,
- librarySource);
- }
- throw new AnalysisNotScheduledError();
- });
- }
-
- @override
ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) {
SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource);
if (sourceEntry is HtmlEntry) {
@@ -14352,7 +14352,7 @@ class _AnalysisFutureHelper<T> {
* updated, it should be free of side effects so that it doesn't cause
* reentrant changes to the analysis state.
*/
- CancelableFuture<T> getFuture(Source source, T
+ CancelableFuture<T> computeAsync(Source source, T
computeValue(SourceEntry sourceEntry)) {
SourceEntry sourceEntry = _context.getReadableSourceEntryOrNull(source);
if (sourceEntry == null) {

Powered by Google App Engine
This is Rietveld 408576698