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

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

Issue 2353433002: Use configurations and declared variables to select import/export URIs during prelinking. (Closed)
Patch Set: Created 4 years, 3 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/lib/src/summary/link.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 d465b405556fad6a281fb6302d3840935c2c43ba..111475c2ce283a605aac7a96028452021a978a24 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -4035,8 +4035,7 @@ class ExportElementImpl extends UriReferencedElementImpl
LibraryElement get exportedLibrary {
if (_unlinkedExportNonPublic != null && _exportedLibrary == null) {
LibraryElementImpl library = enclosingElement as LibraryElementImpl;
- _exportedLibrary = library.resynthesizerContext
- .buildExportedLibrary(_unlinkedExportPublic.uri);
+ _exportedLibrary = library.resynthesizerContext.buildExportedLibrary(uri);
}
return _exportedLibrary;
}
@@ -4078,7 +4077,8 @@ class ExportElementImpl extends UriReferencedElementImpl
@override
String get uri {
if (_unlinkedExportPublic != null) {
- return _unlinkedExportPublic.uri;
+ return _selectUri(
Paul Berry 2016/09/18 13:46:49 For efficiency we should cache this result in a lo
scheglov 2016/09/18 21:03:48 Done.
+ _unlinkedExportPublic.uri, _unlinkedExportPublic.configurations);
}
return super.uri;
}
@@ -5006,7 +5006,7 @@ class ImportElementImpl extends UriReferencedElementImpl
if (_unlinkedImport.isImplicit) {
return null;
}
- return _unlinkedImport.uri;
+ return _selectUri(_unlinkedImport.uri, _unlinkedImport.configurations);
Paul Berry 2016/09/18 13:46:49 Same here.
scheglov 2016/09/18 21:03:48 Done.
}
return super.uri;
}
@@ -8202,6 +8202,17 @@ abstract class UriReferencedElementImpl extends ElementImpl
void set uriOffset(int offset) {
_uriOffset = offset;
}
+
+ String _selectUri(
+ String defaultUri, List<UnlinkedConfiguration> configurations) {
+ for (UnlinkedConfiguration configuration in configurations) {
+ if (context.declaredVariables.get(configuration.name) ==
+ configuration.value) {
+ return configuration.uri;
+ }
+ }
+ return defaultUri;
+ }
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/link.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698