Chromium Code Reviews| 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..58f577a56072bb55aa6320f0ecfa9b1b6a2a73a8 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,6 +62,14 @@ class Compiler extends leg.Compiler { |
| return new leg.Script(uri, sourceFile); |
| } |
| + translateUri(Uri uri, tree.Node node) { |
|
ngeoffray
2012/06/13 12:35:54
Missing return type.
ahe
2012/06/13 14:20:26
Done.
|
| + switch (uri.scheme) { |
| + case 'dart': return translateDartUri(uri, node); |
| + case 'package': return translatePackageUri(uri, node); |
| + default: return uri; |
| + } |
| + } |
| + |
| translateDartUri(Uri uri, tree.Node node) { |
|
ngeoffray
2012/06/13 12:35:54
ditto
ahe
2012/06/13 14:20:26
Done.
|
| String path = DART2JS_LIBRARY_MAP[uri.path]; |
| if (path === null || uri.path.startsWith('_')) { |
| @@ -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); |
| } |
| } |