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

Side by Side Diff: lib/src/compiler.dart

Issue 22928008: Refactor emitter in web-ui to make dart.js the last script, also cleanup tests (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library compiler; 5 library compiler;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection' show SplayTreeMap; 8 import 'dart:collection' show SplayTreeMap;
9 import 'dart:json' as json; 9 import 'dart:json' as json;
10 import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, Ur iBasedDirective; 10 import 'package:analyzer_experimental/src/generated/ast.dart' show Directive, Ur iBasedDirective;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 var bootstrapOutPath = _pathMapper.outputPath(bootstrapPath, ''); 609 var bootstrapOutPath = _pathMapper.outputPath(bootstrapPath, '');
610 var bootstrapOutName = path.basename(bootstrapOutPath); 610 var bootstrapOutName = path.basename(bootstrapOutPath);
611 output.add(new OutputFile(bootstrapOutPath, _bootstrapCode( 611 output.add(new OutputFile(bootstrapOutPath, _bootstrapCode(
612 _pathMapper.importUrlFor(new FileInfo( 612 _pathMapper.importUrlFor(new FileInfo(
613 new UrlInfo('', bootstrapPath, null)), fileInfo), 613 new UrlInfo('', bootstrapPath, null)), fileInfo),
614 _useObservers))); 614 _useObservers)));
615 615
616 var document = file.document; 616 var document = file.document;
617 var hasCss = _emitAllCss(); 617 var hasCss = _emitAllCss();
618 transformMainHtml(document, fileInfo, _pathMapper, hasCss, 618 transformMainHtml(document, fileInfo, _pathMapper, hasCss,
619 options.rewriteUrls, _messages); 619 options.rewriteUrls, _messages, bootstrapOutName);
620
621 document.body.nodes.add(parseFragment(
622 '<script type="application/dart" src="$bootstrapOutName"></script>'));
623
624 output.add(new OutputFile(_pathMapper.outputPath(file.path, '.html'), 620 output.add(new OutputFile(_pathMapper.outputPath(file.path, '.html'),
625 document.outerHtml, source: file.path)); 621 document.outerHtml, source: file.path));
626 } 622 }
627 623
628 // TODO(jmesserly): refactor this and other CSS related transforms out of 624 // TODO(jmesserly): refactor this and other CSS related transforms out of
629 // Compiler. 625 // Compiler.
630 /** 626 /**
631 * Generate an CSS file for all style sheets (main and components). 627 * Generate an CSS file for all style sheets (main and components).
632 * Returns true if a file was generated, otherwise false. 628 * Returns true if a file was generated, otherwise false.
633 */ 629 */
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 813
818 main() { 814 main() {
819 watcher.useObservers = $useObservers; 815 watcher.useObservers = $useObservers;
820 Logger.root.onRecord.listen((record) { 816 Logger.root.onRecord.listen((record) {
821 print('\${record.level.name.toLowerCase()}: \${record.message}'); 817 print('\${record.level.name.toLowerCase()}: \${record.message}');
822 }); 818 });
823 userMain.main(); 819 userMain.main();
824 userMain.init_autogenerated(); 820 userMain.init_autogenerated();
825 } 821 }
826 """; 822 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698