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

Unified Diff: pkg/analyzer/lib/src/summary/package_bundle_reader.dart

Issue 2486573002: Provide LINE_INFO using just UnlinkedUnit even though the full info is not available. (Closed)
Patch Set: Created 4 years, 1 month 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 | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/package_bundle_reader.dart
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index c60f8ba6ca024cde45bbd0993ba8746a38de4248..23645da1d89ae9620ec7da0ab37b2d135aaa4d67 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -174,6 +174,23 @@ abstract class ResynthesizerResultProvider extends ResultProvider {
return true;
}
AnalysisTarget target = entry.target;
+
+ // LINE_INFO can be provided using just the UnlinkedUnit.
+ if (target is Source && result == LINE_INFO) {
+ String uriString = target.uri.toString();
+ UnlinkedUnit unlinkedUnit = _dataStore.unlinkedMap[uriString];
+ if (unlinkedUnit != null) {
+ List<int> lineStarts = unlinkedUnit.lineStarts;
+ if (lineStarts.isNotEmpty) {
+ LineInfo lineInfo = new LineInfo(lineStarts);
+ entry.setValue(result as ResultDescriptor<LineInfo>, lineInfo,
+ TargetedResult.EMPTY_LIST);
+ return true;
+ }
+ }
+ return false;
+ }
+
// Check whether there are results for the source.
if (!hasResultsForSource(target.librarySource ?? target.source)) {
return false;
@@ -239,16 +256,6 @@ abstract class ResynthesizerResultProvider extends ResultProvider {
return true;
}
return false;
- } else if (result == LINE_INFO) {
- UnlinkedUnit unlinkedUnit = _dataStore.unlinkedMap[uriString];
- List<int> lineStarts = unlinkedUnit.lineStarts;
- if (lineStarts.isNotEmpty) {
- LineInfo lineInfo = new LineInfo(lineStarts);
- entry.setValue(result as ResultDescriptor<LineInfo>, lineInfo,
- TargetedResult.EMPTY_LIST);
- return true;
- }
- return false;
}
} else if (target is LibrarySpecificUnit) {
if (result == CREATED_RESOLVED_UNIT1 ||
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698