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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 16114013: Reland "Add --version option to dart2js and add version information (if available) to generated cod… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix formatting. Created 7 years, 7 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 | « sdk/lib/_internal/compiler/implementation/dart2js.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
index 6ecbfd5099e1e4ab723fd545a494966e5544cb0b..e24d33b7b2b9e0412d4a92020812ce4c6f680db1 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart
@@ -2948,7 +2948,7 @@ if (typeof document !== "undefined" && document.readyState !== "complete") {
computeNeededClasses();
- mainBuffer.add(GENERATED_BY);
+ mainBuffer.add(buildGeneratedBy());
addComment(HOOKS_API_USAGE, mainBuffer);
mainBuffer.add('function ${namer.isolateName}()$_{}\n');
mainBuffer.add('init()$N$n');
@@ -3173,7 +3173,7 @@ if (typeof document !== "undefined" && document.readyState !== "complete") {
void emitDeferredPreambleWhenEmpty(CodeBuffer buffer) {
if (!buffer.isEmpty) return;
- buffer.write(GENERATED_BY);
+ buffer.write(buildGeneratedBy());
buffer.write('var old${namer.CURRENT_ISOLATE}$_='
'$_${namer.CURRENT_ISOLATE}$N');
@@ -3186,6 +3186,12 @@ if (typeof document !== "undefined" && document.readyState !== "complete") {
'$_${namer.isolateName}.prototype$N$n');
}
+ String buildGeneratedBy() {
+ var suffix = '';
+ if (compiler.hasBuildId) suffix = ' version: ${compiler.buildId}';
+ return '// Generated by dart2js, the Dart to JavaScript compiler$suffix.\n';
+ }
+
String buildSourceMap(CodeBuffer buffer, SourceFile compiledFile) {
SourceMapBuilder sourceMapBuilder =
new SourceMapBuilder(compiler.sourceMapUri);
@@ -3214,10 +3220,6 @@ if (typeof document !== "undefined" && document.readyState !== "complete") {
}
}
-const String GENERATED_BY = """
-// Generated by dart2js, the Dart to JavaScript compiler.
-""";
-
const String HOOKS_API_USAGE = """
// The code supports the following hooks:
// dartPrint(message) - if this function is defined it is called
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698