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

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

Issue 10032015: Add support for the package: directive in Frog and dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« frog/reader.dart ('K') | « frog/reader.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/apiimpl.dart
diff --git a/lib/compiler/implementation/apiimpl.dart b/lib/compiler/implementation/apiimpl.dart
index 4301708c40a05ee726362258b91490a18f9a907f..78cf17d41c0323dcb519979c2d39223c11d5e26b 100644
--- a/lib/compiler/implementation/apiimpl.dart
+++ b/lib/compiler/implementation/apiimpl.dart
@@ -19,6 +19,7 @@ class Compiler extends leg.Compiler {
ReadUriFromString provider;
DiagnosticHandler handler;
Uri libraryRoot;
+ Uri packageRoot;
List<String> options;
bool mockableLibraryUsed = false;
@@ -38,6 +39,8 @@ class Compiler extends leg.Compiler {
leg.Script readScript(Uri uri, [leg.ScriptTag node]) {
if (uri.scheme == 'dart') {
uri = translateDartUri(uri, node);
+ } else if (uri.scheme == 'package') {
+ uri = translatePackageUri(uri, node);
}
String text = "";
try {
@@ -65,7 +68,11 @@ class Compiler extends leg.Compiler {
return libraryRoot.resolve(path);
}
+ translatePackageUri(Uri uri, leg.ScriptTag node) =>
Bob Nystrom 2012/04/09 23:54:08 I <3 => too, but I think a regular {} body is bett
nweiz 2012/04/10 00:16:31 I think it's fine for a single-line body, even if
+ packageRoot.resolve(uri.path);
+
bool run(Uri uri) {
+ packageRoot = uri.resolve('packages/');
bool success = super.run(uri);
for (final task in tasks) {
log('${task.name} took ${task.timing}msec');
« frog/reader.dart ('K') | « frog/reader.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698