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

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

Issue 988483006: Add widget to display errors, and report dependency_graph errors correctly (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 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
Index: lib/src/codegen/html_codegen.dart
diff --git a/lib/src/codegen/html_codegen.dart b/lib/src/codegen/html_codegen.dart
index a12ddbdd2b43b6da09b7ec57a8f29ab2b159510f..80be996f4c77ed114147af782d709809c7c4b333 100644
--- a/lib/src/codegen/html_codegen.dart
+++ b/lib/src/codegen/html_codegen.dart
@@ -47,7 +47,7 @@ String generateEntryHtml(HtmlSourceNode root, CompilerOptions options) {
}, includeParts: false);
String mainLibraryName;
- var fragment = _loadRuntimeScripts();
+ var fragment = _loadRuntimeScripts(options);
if (!options.checkSdk) fragment.nodes.add(_miniMockSdk);
for (var lib in libraries) {
var info = lib.info;
@@ -62,18 +62,29 @@ String generateEntryHtml(HtmlSourceNode root, CompilerOptions options) {
/// A document fragment with scripts that check for harmony features and that
/// inject our runtime.
-Node _loadRuntimeScripts() => parseFragment('''
-<script src="dev_compiler/runtime/harmony_feature_check.js"></script>
-<script src="dev_compiler/runtime/dart_runtime.js"></script>
-''');
+Node _loadRuntimeScripts(options) {
+ // TODO(sigmund): use dev_compiler to generate messages_widget in the future.
+ var widgetCode = options.serverMode
+ ? '<script src="dev_compiler/runtime/messages_widget.js"></script>\n'
+ '<link rel="stylesheet" href="dev_compiler/runtime/messages.css">'
+ : '';
+ return parseFragment(
+ '<script src="dev_compiler/runtime/harmony_feature_check.js"></script>\n'
+ '<script src="dev_compiler/runtime/dart_runtime.js"></script>\n'
+ '$widgetCode');
+}
/// A script tag that loads the .js code for a compiled library.
Node _libraryInclude(String jsUrl) =>
parseFragment('<script src="$jsUrl"></script>\n');
/// A script tag that invokes the main function on the entry point library.
-Node _invokeMain(String mainLibraryName) =>
- parseFragment('<script>$mainLibraryName.main();</script>\n');
+Node _invokeMain(String mainLibraryName) {
+ var code = mainLibraryName == null
+ ? 'console.error("dev_compiler error: main was not generated");'
+ : '$mainLibraryName.main();';
+ return parseFragment('<script>$code</script>\n');
+}
/// A script tag with a tiny mock of the core SDK. This is just used for testing
/// some small samples.

Powered by Google App Engine
This is Rietveld 408576698