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

Unified Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1212973003: Fix another new task model test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/context/context.dart
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index b14faf0fcc25fd3930369c50497cdf1be87f1c42..a3c427fb831dd416f9dfd199ffae62e6175fb72d 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -566,16 +566,16 @@ class AnalysisContextImpl implements InternalAnalysisContext {
List<AnalysisError> computeErrors(Source source) {
String name = source.shortName;
if (AnalysisEngine.isDartFileName(name)) {
- return _computeResult(source, DART_ERRORS);
+ return computeResult(source, DART_ERRORS);
} else if (AnalysisEngine.isHtmlFileName(name)) {
- return _computeResult(source, HTML_ERRORS);
+ return computeResult(source, HTML_ERRORS);
}
return AnalysisError.NO_ERRORS;
}
@override
List<Source> computeExportedLibraries(Source source) =>
- _computeResult(source, EXPORTED_LIBRARIES);
+ computeResult(source, EXPORTED_LIBRARIES);
@override
@deprecated
@@ -587,13 +587,13 @@ class AnalysisContextImpl implements InternalAnalysisContext {
@override
List<Source> computeImportedLibraries(Source source) =>
- _computeResult(source, EXPLICITLY_IMPORTED_LIBRARIES);
+ computeResult(source, EXPLICITLY_IMPORTED_LIBRARIES);
@override
SourceKind computeKindOf(Source source) {
String name = source.shortName;
if (AnalysisEngine.isDartFileName(name)) {
- return _computeResult(source, SOURCE_KIND);
+ return computeResult(source, SOURCE_KIND);
} else if (AnalysisEngine.isHtmlFileName(name)) {
return SourceKind.HTML;
}
@@ -603,11 +603,11 @@ class AnalysisContextImpl implements InternalAnalysisContext {
@override
LibraryElement computeLibraryElement(Source source) {
//_computeResult(source, HtmlEntry.ELEMENT);
- return _computeResult(source, LIBRARY_ELEMENT);
+ return computeResult(source, LIBRARY_ELEMENT);
}
@override
- LineInfo computeLineInfo(Source source) => _computeResult(source, LINE_INFO);
+ LineInfo computeLineInfo(Source source) => computeResult(source, LINE_INFO);
@override
@deprecated
@@ -637,6 +637,21 @@ class AnalysisContextImpl implements InternalAnalysisContext {
});
}
+ Object /*V*/ computeResult(
+ AnalysisTarget target, ResultDescriptor /*<V>*/ descriptor) {
+ CacheEntry entry = getCacheEntry(target);
+ CacheState state = entry.getState(descriptor);
+ if (state == CacheState.FLUSHED || state == CacheState.INVALID) {
+ driver.computeResult(target, descriptor);
+ }
+ state = entry.getState(descriptor);
+ if (state == CacheState.ERROR) {
+ throw new AnalysisException(
+ 'Cannot compute $descriptor for $target', entry.exception);
+ }
+ return entry.getValue(descriptor);
+ }
+
/**
* Create an analysis cache based on the given source [factory].
*/
@@ -1013,7 +1028,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
throw new AnalysisException('Could not get contents of $source',
new CaughtException(exception, stackTrace));
}
- return _computeResult(source, PARSED_UNIT);
+ return computeResult(source, PARSED_UNIT);
}
@override
@@ -1021,7 +1036,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
if (!AnalysisEngine.isHtmlFileName(source.shortName)) {
return null;
}
- return _computeResult(source, HTML_DOCUMENT);
+ return computeResult(source, HTML_DOCUMENT);
}
@override
@@ -1131,7 +1146,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
!AnalysisEngine.isDartFileName(librarySource.shortName)) {
return null;
}
- return _computeResult(
+ return computeResult(
new LibrarySpecificUnit(librarySource, unitSource), RESOLVED_UNIT);
}
@@ -1331,21 +1346,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
}
- Object /*V*/ _computeResult(
- AnalysisTarget target, ResultDescriptor /*<V>*/ descriptor) {
- CacheEntry entry = getCacheEntry(target);
- CacheState state = entry.getState(descriptor);
- if (state == CacheState.FLUSHED || state == CacheState.INVALID) {
- driver.computeResult(target, descriptor);
- }
- state = entry.getState(descriptor);
- if (state == CacheState.ERROR) {
- throw new AnalysisException(
- 'Cannot compute $descriptor for $target', entry.exception);
- }
- return entry.getValue(descriptor);
- }
-
/**
* Given the encoded form of a source ([encoding]), use the source factory to
* reconstitute the original source.
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698