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

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

Issue 2489383002: Don't add imports/exports elements for invalid URIs, with null Source. (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 | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index e4a608597b6fd23f87d53f453b86a2fb1dab6e2e..501f0df39d12a78adbc5f47287787d5024014939 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -5461,14 +5461,20 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
_unlinkedDefiningUnit.exports.length == unlinkedPublicExports.length);
int length = unlinkedNonPublicExports.length;
if (length != 0) {
- List<ExportElement> exports = new List<ExportElement>(length);
+ List<ExportElement> exports = new List<ExportElement>();
for (int i = 0; i < length; i++) {
UnlinkedExportPublic serializedExportPublic =
unlinkedPublicExports[i];
- UnlinkedExportNonPublic serializedExportNonPublic =
- unlinkedNonPublicExports[i];
- exports[i] = new ExportElementImpl.forSerialized(
- serializedExportPublic, serializedExportNonPublic, library);
+ LibraryElement exportedLibrary = resynthesizerContext
+ .buildExportedLibrary(serializedExportPublic.uri);
+ if (exportedLibrary != null) {
+ UnlinkedExportNonPublic serializedExportNonPublic =
+ unlinkedNonPublicExports[i];
+ ExportElementImpl exportElement =
+ new ExportElementImpl.forSerialized(
+ serializedExportPublic, serializedExportNonPublic, library);
+ exports.add(exportElement);
+ }
}
_exports = exports;
} else {
@@ -5534,11 +5540,18 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
List<UnlinkedImport> unlinkedImports = _unlinkedDefiningUnit.imports;
int length = unlinkedImports.length;
if (length != 0) {
- List<ImportElement> imports = new List<ImportElement>(length);
+ List<ImportElement> imports = new List<ImportElement>();
LinkedLibrary linkedLibrary = resynthesizerContext.linkedLibrary;
for (int i = 0; i < length; i++) {
- imports[i] = new ImportElementImpl.forSerialized(
- unlinkedImports[i], linkedLibrary.importDependencies[i], library);
+ int dependency = linkedLibrary.importDependencies[i];
+ LibraryElement importedLibrary =
+ resynthesizerContext.buildImportedLibrary(dependency);
+ if (importedLibrary != null) {
+ ImportElementImpl importElement =
+ new ImportElementImpl.forSerialized(
+ unlinkedImports[i], dependency, library);
+ imports.add(importElement);
+ }
}
_imports = imports;
} else {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698