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

Unified Diff: dart/lib/compiler/implementation/apiimpl.dart

Issue 10533123: Libraries should know their original URI, not their translated URI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/compiler/implementation/apiimpl.dart
diff --git a/dart/lib/compiler/implementation/apiimpl.dart b/dart/lib/compiler/implementation/apiimpl.dart
index 938c8bbd2e46255eec4c886f39ef187b21f162d8..c1dbfcd0a4d97f40f2a0cded0f49abbc0b15389f 100644
--- a/dart/lib/compiler/implementation/apiimpl.dart
+++ b/dart/lib/compiler/implementation/apiimpl.dart
@@ -43,16 +43,12 @@ class Compiler extends leg.Compiler {
}
leg.Script readScript(Uri uri, [tree.Node node]) {
- if (uri.scheme == 'dart') {
- uri = translateDartUri(uri, node);
- } else if (uri.scheme == 'package') {
- uri = translatePackageUri(uri, node);
- }
+ var translated = translateUri(uri, node);
String text = "";
try {
// TODO(ahe): We expect the future to be complete and call value
// directly. In effect, we don't support truly asynchronous API.
- text = provider(uri).value;
+ text = provider(translated).value;
} catch (var exception) {
if (node !== null) {
cancel("$exception", node: node);
@@ -66,7 +62,15 @@ class Compiler extends leg.Compiler {
return new leg.Script(uri, sourceFile);
}
- translateDartUri(Uri uri, tree.Node node) {
+ Uri translateUri(Uri uri, tree.Node node) {
+ switch (uri.scheme) {
+ case 'dart': return translateDartUri(uri, node);
+ case 'package': return translatePackageUri(uri, node);
+ default: return uri;
+ }
+ }
+
+ Uri translateDartUri(Uri uri, tree.Node node) {
String path = DART2JS_LIBRARY_MAP[uri.path];
if (path === null || uri.path.startsWith('_')) {
reportError(node, 'library not found ${uri}');
@@ -95,7 +99,8 @@ class Compiler extends leg.Compiler {
if (span === null) {
handler(null, null, null, message, fatal);
} else {
- handler(span.uri, span.begin, span.end, message, fatal);
+ handler(translateUri(span.uri, null), span.begin, span.end,
+ message, fatal);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698