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

Unified Diff: lib/src/codegen/js_printer.dart

Issue 1788973002: Remove code that requires whole-program compile (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 4 years, 9 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/codegen/js_field_storage.dart ('k') | lib/src/codegen/reify_coercions.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
}
}
}
« no previous file with comments | « lib/src/codegen/js_field_storage.dart ('k') | lib/src/codegen/reify_coercions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698