Index: lib/src/codegen/js_printer.dart |
diff --git a/lib/src/codegen/js_printer.dart b/lib/src/codegen/js_printer.dart |
index 451e8e1b6f743bb271a151e357de58324ed8d69c..0ea6f5875310e7e2fc280838731243a615ba9132 100644 |
--- a/lib/src/codegen/js_printer.dart |
+++ b/lib/src/codegen/js_printer.dart |
@@ -16,8 +16,7 @@ import '../utils.dart' show FileSystem, computeHash, locationForOffset; |
import 'js_names.dart' show TemporaryNamer; |
-String writeJsLibrary( |
- JS.Program jsTree, String outputPath, String inputDir, Uri serverUri, |
+void writeJsLibrary(JS.Program jsTree, String outputPath, String inputDir, |
{bool emitSourceMaps: false, |
bool emitTypes: false, |
FileSystem fileSystem}) { |
@@ -27,8 +26,7 @@ String writeJsLibrary( |
JS.JavaScriptPrintingContext context; |
if (emitSourceMaps) { |
var printer = new srcmaps.Printer(outFilename); |
- context = |
- new SourceMapPrintingContext(printer, outDir, inputDir, serverUri); |
+ context = new SourceMapPrintingContext(printer, outDir, inputDir, null); |
} else { |
context = new JS.SimpleJavaScriptPrintingContext(); |
} |
@@ -69,8 +67,6 @@ String writeJsLibrary( |
// TODO(jmesserly): should only do this if the input file was executable? |
if (!Platform.isWindows) Process.runSync('chmod', ['+x', outputPath]); |
} |
- |
- return computeHash(text); |
} |
class SourceMapPrintingContext extends JS.JavaScriptPrintingContext { |
@@ -78,15 +74,13 @@ class SourceMapPrintingContext extends JS.JavaScriptPrintingContext { |
final String outputDir; |
final String inputDir; |
- // TODO(vsm): we could abstract this out and have a generic Uri mapping |
- // instead of hardcoding a notion of a server uri. |
- final Uri serverUri; |
+ final Uri baseUri; |
CompilationUnit unit; |
Uri uri; |
SourceMapPrintingContext( |
- this.printer, this.outputDir, this.inputDir, this.serverUri); |
+ this.printer, this.outputDir, this.inputDir, this.baseUri); |
void emit(String string) { |
printer.add(string); |
@@ -124,13 +118,13 @@ class SourceMapPrintingContext extends JS.JavaScriptPrintingContext { |
locationForOffset(unit.lineInfo, uri, offset); |
Uri _makeRelativeUri(Uri src) { |
- if (serverUri == null) { |
+ if (baseUri == null) { |
return new Uri(path: path.relative(src.path, from: outputDir)); |
} else { |
if (src.path.startsWith('/')) { |
- return serverUri.resolve(path.relative(src.path, from: inputDir)); |
+ return baseUri.resolve(path.relative(src.path, from: inputDir)); |
} else { |
- return serverUri.resolve(path.join('packages', src.path)); |
+ return baseUri.resolve(path.join('packages', src.path)); |
} |
} |
} |