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

Unified Diff: lib/src/compiler/compiler.dart

Issue 2288453002: Make source map paths relative (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix comment Created 4 years, 4 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 | « lib/src/compiler/code_generator.dart ('k') | test/codegen_expected/map_keys.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/compiler/compiler.dart
diff --git a/lib/src/compiler/compiler.dart b/lib/src/compiler/compiler.dart
index d9b6b9630283595e72a25147f74b18daa4671e59..b47ad2505d00328c0b6c2d803c8738dfa042f76b 100644
--- a/lib/src/compiler/compiler.dart
+++ b/lib/src/compiler/compiler.dart
@@ -363,7 +363,11 @@ class JSModuleFile {
new JS.Printer(opts, printer, localNamer: new JS.TemporaryNamer(tree)));
if (options.sourceMap && options.sourceMapComment) {
- printer.emit('\n//# sourceMappingURL=$mapUrl\n');
+ var relativeMapUrl = path
+ .toUri(path.relative(path.fromUri(mapUrl), from: path.dirname(jsUrl)))
+ .toString();
+ assert(path.dirname(jsUrl) == path.dirname(mapUrl));
+ printer.emit('\n//# sourceMappingURL=$relativeMapUrl\n');
}
Map builtMap;
@@ -413,9 +417,11 @@ Map placeSourceMap(Map sourceMap, String sourceMapPath) {
var map = new Map.from(sourceMap);
List list = new List.from(map['sources']);
map['sources'] = list;
+ String relative(String uri) =>
+ path.toUri(path.relative(path.fromUri(uri), from: dir)).toString();
for (int i = 0; i < list.length; i++) {
- list[i] =
- path.toUri(path.relative(path.fromUri(list[i]), from: dir)).toString();
+ list[i] = relative(list[i]);
}
+ map['file'] = relative(map['file']);
return map;
}
« no previous file with comments | « lib/src/compiler/code_generator.dart ('k') | test/codegen_expected/map_keys.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698