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

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

Issue 2809523002: Issue 29288. Resynthesize Import/Export/PartElement for every directive. (Closed)
Patch Set: Created 3 years, 8 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
Index: pkg/analyzer/lib/src/summary/resynthesize.dart
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index da24abaff0592f467932894aeed74fc92112ef18..a6620cc6f5b8f6920815ab98cf92b9ebfb2964e1 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -213,13 +213,13 @@ abstract class SummaryResynthesizer extends ElementResynthesizer {
List<UnlinkedUnit> serializedUnits = <UnlinkedUnit>[unlinkedSummary];
for (String part in serializedUnits[0].publicNamespace.parts) {
Source partSource = sourceFactory.resolveUri(librarySource, part);
- if (partSource == null) {
- serializedUnits.add(null);
- } else {
+ UnlinkedUnit partUnlinkedUnit;
+ if (partSource != null) {
String partAbsUri = partSource.uri.toString();
- serializedUnits.add(getUnlinkedSummary(partAbsUri) ??
- new UnlinkedUnitBuilder(codeRange: new CodeRangeBuilder()));
+ partUnlinkedUnit = getUnlinkedSummary(partAbsUri);
}
+ serializedUnits.add(partUnlinkedUnit ??
+ new UnlinkedUnitBuilder(codeRange: new CodeRangeBuilder()));
}
_LibraryResynthesizer libraryResynthesizer = new _LibraryResynthesizer(
this, serializedLibrary, serializedUnits, librarySource);
@@ -1037,9 +1037,6 @@ class _LibraryResynthesizer {
String uri, UnlinkedPart partDecl, int unitNum) {
Source unitSource =
summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri);
- if (unitSource == null) {
- return null;
- }
_UnitResynthesizer partResynthesizer =
createUnitResynthesizer(unitNum, unitSource, partDecl);
CompilationUnitElementImpl partUnit = partResynthesizer.unit;
@@ -1101,10 +1098,13 @@ class _LibraryResynthesizer {
/**
* Remember the absolute URI to the corresponding unit mapping.
*/
- void rememberUriToUnit(_UnitResynthesizer unitResynthesized) {
- CompilationUnitElementImpl unit = unitResynthesized.unit;
- String absoluteUri = unit.source.uri.toString();
- resynthesizedUnits[absoluteUri] = unit;
+ void rememberUriToUnit(_UnitResynthesizer unitResynthesizer) {
+ CompilationUnitElementImpl unit = unitResynthesizer.unit;
+ Source source = unit.source;
+ if (source != null) {
+ String absoluteUri = source.uri.toString();
+ resynthesizedUnits[absoluteUri] = unit;
+ }
}
}
@@ -1512,7 +1512,7 @@ class _UnitResynthesizer {
_resynthesizerContext,
unlinkedUnit,
unlinkedPart,
- unitSource.shortName);
+ unitSource?.shortName);
{
List<int> lineStarts = unlinkedUnit.lineStarts;

Powered by Google App Engine
This is Rietveld 408576698