OLD | NEW |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 /** Compile the application starting from the given [mainFile]. */ | 101 /** Compile the application starting from the given [mainFile]. */ |
102 Future run() { | 102 Future run() { |
103 if (path.basename(_mainPath).endsWith('.dart')) { | 103 if (path.basename(_mainPath).endsWith('.dart')) { |
104 _messages.error("Please provide an HTML file as your entry point.", | 104 _messages.error("Please provide an HTML file as your entry point.", |
105 null, file: _mainPath); | 105 null, file: _mainPath); |
106 return new Future.immediate(null); | 106 return new Future.immediate(null); |
107 } | 107 } |
108 return _parseAndDiscover(_mainPath).then((_) { | 108 return _parseAndDiscover(_mainPath).then((_) { |
109 _analyze(); | 109 _analyze(); |
| 110 // TODO(jmesserly): need to go through our errors, and figure out if some |
| 111 // of them should be warnings instead. |
| 112 if (_messages.hasErrors) return; |
110 _transformDart(); | 113 _transformDart(); |
111 _emit(); | 114 _emit(); |
112 // TODO(jmesserly): need to go through our errors, and figure out if some | |
113 // of them should be warnings instead. | |
114 if (_messages.hasErrors) output.clear(); | |
115 }); | 115 }); |
116 } | 116 } |
117 | 117 |
118 /** | 118 /** |
119 * Asynchronously parse [inputFile] and transitively discover web components | 119 * Asynchronously parse [inputFile] and transitively discover web components |
120 * to load and parse. Returns a future that completes when all files are | 120 * to load and parse. Returns a future that completes when all files are |
121 * processed. | 121 * processed. |
122 */ | 122 */ |
123 Future _parseAndDiscover(String inputFile) { | 123 Future _parseAndDiscover(String inputFile) { |
124 _tasks = new FutureGroup(); | 124 _tasks = new FutureGroup(); |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 component.declaringFile.inputPath, messages, options); | 725 component.declaringFile.inputPath, messages, options); |
726 if (styleSheet != null) { | 726 if (styleSheet != null) { |
727 component.styleSheets.add(styleSheet); | 727 component.styleSheets.add(styleSheet); |
728 } | 728 } |
729 } | 729 } |
730 } | 730 } |
731 | 731 |
732 super.visitElementInfo(info); | 732 super.visitElementInfo(info); |
733 } | 733 } |
734 } | 734 } |
OLD | NEW |