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

Unified Diff: pkg/compiler/lib/src/js_emitter/headers.dart

Issue 1271953003: dart2js: Add a header to the output of the startup emitter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add flavor section to generatedBy comment. Created 5 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
Index: pkg/compiler/lib/src/js_emitter/headers.dart
diff --git a/pkg/compiler/lib/src/js_emitter/headers.dart b/pkg/compiler/lib/src/js_emitter/headers.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a8466cef0cc0f3e910744e5bb6f5703066600e83
--- /dev/null
+++ b/pkg/compiler/lib/src/js_emitter/headers.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library dart2js.js_emitter.headers;
+import '../apiimpl.dart' show Compiler;
+
+String generatedBy(Compiler compiler, {String flavor: ""}) {
+ String suffix = '';
+ if (compiler.hasBuildId) suffix = ' version: ${compiler.buildId}';
+ if (flavor != "") flavor = " ($flavor)";
+ return '// Generated by dart2js$flavor, '
+ 'the Dart to JavaScript compiler$suffix.';
+}
+
+const String HOOKS_API_USAGE = """
+// The code supports the following hooks:
+// dartPrint(message):
+// if this function is defined it is called instead of the Dart [print]
+// method.
+//
+// dartMainRunner(main, args):
+// if this function is defined, the Dart [main] method will not be invoked
+// directly. Instead, a closure that will invoke [main], and its arguments
+// [args] is passed to [dartMainRunner].
+//
+// dartDeferredLibraryLoader(uri, successCallback, errorCallback):
+// if this function is defined, it will be called when a deferered library
+// is loaded. It should load and eval the javascript of `uri`, and call
+// successCallback. If it fails to do so, it should call errorCallback with
+// an error.
+""";

Powered by Google App Engine
This is Rietveld 408576698