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

Unified Diff: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart

Issue 13797002: Change MirrorSystem.libraries to Map<Uri, String> (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 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: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
index 17f40f6824338b8328039134e7514ac41bec56ba..f3dce015cc55fc42c11c8323d4d06b3000d67609 100644
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_mirror.dart
@@ -209,17 +209,16 @@ Future<String> compile(Path script,
{Path packageRoot,
List<String> options: const <String>[],
api.DiagnosticHandler diagnosticHandler}) {
- Uri cwd = getCurrentDirectory();
SourceFileProvider provider = new SourceFileProvider();
if (diagnosticHandler == null) {
diagnosticHandler =
new FormattingDiagnosticHandler(provider).diagnosticHandler;
}
- Uri scriptUri = cwd.resolve(script.toString());
- Uri libraryUri = cwd.resolve(appendSlash('$libraryRoot'));
+ Uri scriptUri = currentDirectory.resolve(script.toString());
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
Uri packageUri = null;
if (packageRoot != null) {
- packageUri = cwd.resolve(appendSlash('$packageRoot'));
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
}
return api.compile(scriptUri, libraryUri, packageUri,
provider.readStringFromUri, diagnosticHandler, options);
@@ -282,20 +281,19 @@ Future<MirrorSystem> analyze(List<Path> libraries,
{Path packageRoot,
List<String> options: const <String>[],
api.DiagnosticHandler diagnosticHandler}) {
- Uri cwd = getCurrentDirectory();
SourceFileProvider provider = new SourceFileProvider();
if (diagnosticHandler == null) {
diagnosticHandler =
new FormattingDiagnosticHandler(provider).diagnosticHandler;
}
- Uri libraryUri = cwd.resolve(appendSlash('$libraryRoot'));
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
Uri packageUri = null;
if (packageRoot != null) {
- packageUri = cwd.resolve(appendSlash('$packageRoot'));
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
}
List<Uri> librariesUri = <Uri>[];
for (Path library in libraries) {
- librariesUri.add(cwd.resolve(library.toString()));
+ librariesUri.add(currentDirectory.resolve(library.toString()));
}
return analyzeUri(librariesUri, libraryUri, packageUri,
provider.readStringFromUri, diagnosticHandler, options);
@@ -465,9 +463,9 @@ abstract class Dart2JsMemberMirror extends Dart2JsElementMirror
// Mirror system implementation.
//------------------------------------------------------------------------------
-class Dart2JsMirrorSystem implements MirrorSystem {
+class Dart2JsMirrorSystem extends MirrorSystem {
final Compiler compiler;
- Map<String, Dart2JsLibraryMirror> _libraries;
+ Map<Uri, Dart2JsLibraryMirror> _libraries;
Map<LibraryElement, Dart2JsLibraryMirror> _libraryMap;
Dart2JsMirrorSystem(this.compiler)
@@ -475,18 +473,18 @@ class Dart2JsMirrorSystem implements MirrorSystem {
void _ensureLibraries() {
if (_libraries == null) {
- _libraries = <String, Dart2JsLibraryMirror>{};
+ _libraries = new Map<Uri, Dart2JsLibraryMirror>();
compiler.libraries.forEach((_, LibraryElement v) {
var mirror = new Dart2JsLibraryMirror(mirrors, v);
- _libraries[mirror.simpleName] = mirror;
+ _libraries[mirror.uri] = mirror;
_libraryMap[v] = mirror;
});
}
}
- Map<String, LibraryMirror> get libraries {
+ Map<Uri, LibraryMirror> get libraries {
_ensureLibraries();
- return new ImmutableMapWrapper<String, LibraryMirror>(_libraries);
+ return new ImmutableMapWrapper<Uri, LibraryMirror>(_libraries);
}
Dart2JsLibraryMirror _getLibrary(LibraryElement element) =>

Powered by Google App Engine
This is Rietveld 408576698