| Index: lib/src/codegen.dart
|
| diff --git a/lib/src/codegen.dart b/lib/src/codegen.dart
|
| index f3c3730a11e3cfcecd481dcf667d3d23fd19c46a..26636f4e98c100592fca2b0c3604097419ba9727 100644
|
| --- a/lib/src/codegen.dart
|
| +++ b/lib/src/codegen.dart
|
| @@ -14,14 +14,15 @@ import 'utils.dart';
|
| * null then there is no file associated with the template (used by testing
|
| * so we'll display <MEMORY> for file name.
|
| */
|
| -String header(Path path, String libraryName) => """
|
| +String header(Path path, String libraryName) {
|
| + var library = libraryName != null ? '\nlibrary $libraryName;\n' : '';
|
| + return """
|
| // Auto-generated from ${path != null ? path.filename : "<MEMORY>"}.
|
| // DO NOT EDIT.
|
| -
|
| -library $libraryName;
|
| -
|
| +$library
|
| $imports
|
| """;
|
| +}
|
|
|
| // TODO(sigmund): include only those imports that are used by the code.
|
| String get imports => """
|
| @@ -34,12 +35,14 @@ import 'package:web_ui/web_ui.dart' as autogenerated;
|
| * The code that will be used to bootstrap the application, this is inlined in
|
| * the main.html.html output file.
|
| */
|
| -String bootstrapCode(Path userMainImport) => """
|
| +String bootstrapCode(Path userMainImport, bool useObservers) => """
|
| library bootstrap;
|
|
|
| +import 'package:web_ui/watcher.dart' as watcher;
|
| import '$userMainImport' as userMain;
|
|
|
| main() {
|
| + watcher.useObservers = $useObservers;
|
| userMain.main();
|
| userMain.init_autogenerated();
|
| }
|
| @@ -47,32 +50,4 @@ main() {
|
|
|
| /** Generate text for a list of imports. */
|
| String importList(Iterable<Path> imports) =>
|
| - imports.map((url) => "import '$url';").join('\n');
|
| -
|
| -/**
|
| - * Text corresponding to a directive, fixed in case the code is in a different
|
| - * output location.
|
| - */
|
| -String directiveText(
|
| - DartDirectiveInfo directive, LibraryInfo src, PathInfo pathInfo) {
|
| - var buff = new StringBuffer();
|
| - var uri = pathInfo.transformUrl(src.inputPath, directive.uri);
|
| - buff..add(directive.label)
|
| - ..add(" '")
|
| - ..add(uri.replaceAll("'", "\\'"))
|
| - ..add("'");
|
| - if (directive.prefix != null) {
|
| - buff..add(' as ')
|
| - ..add(directive.prefix);
|
| - }
|
| - if (directive.show != null) {
|
| - buff..add(' show ')
|
| - ..add(directive.show.join(','));
|
| - }
|
| - if (directive.hide != null) {
|
| - buff..add(' hide ')
|
| - ..add(directive.hide.join(','));
|
| - }
|
| - buff.add(';');
|
| - return buff.toString();
|
| -}
|
| + imports.map((url) => "import '$url';").join('\n');
|
|
|