| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Development server that compiles Dart to JS on the fly. | 5 /// Development server that compiles Dart to JS on the fly. |
| 6 library dev_compiler.src.server; | 6 library dev_compiler.src.server; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 rebuild(_entryNode, _buildSource); | 82 rebuild(_entryNode, _buildSource); |
| 83 _dumpInfoIfRequested(); | 83 _dumpInfoIfRequested(); |
| 84 clock.stop(); | 84 clock.stop(); |
| 85 var time = (clock.elapsedMilliseconds / 1000).toStringAsFixed(2); | 85 var time = (clock.elapsedMilliseconds / 1000).toStringAsFixed(2); |
| 86 _log.fine('Compiled ${_libraries.length} libraries in ${time} s\n'); | 86 _log.fine('Compiled ${_libraries.length} libraries in ${time} s\n'); |
| 87 return new CheckerResults( | 87 return new CheckerResults( |
| 88 _libraries, _failure || options.codegenOptions.forceCompile); | 88 _libraries, _failure || options.codegenOptions.forceCompile); |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool _buildSource(SourceNode node) { | 91 bool _buildSource(SourceNode node) { |
| 92 node.clearSummary(); |
| 92 if (node is HtmlSourceNode) { | 93 if (node is HtmlSourceNode) { |
| 93 _buildHtmlFile(node); | 94 _buildHtmlFile(node); |
| 94 } else if (node is DartSourceNode) { | 95 } else if (node is DartSourceNode) { |
| 95 _buildDartLibrary(node); | 96 _buildDartLibrary(node); |
| 96 } else if (node is ResourceSourceNode) { | 97 } else if (node is ResourceSourceNode) { |
| 97 _buildResourceFile(node); | 98 _buildResourceFile(node); |
| 98 } else { | 99 } else { |
| 99 assert(false); // should not get a build request on PartSourceNode | 100 assert(false); // should not get a build request on PartSourceNode |
| 100 } | 101 } |
| 101 | 102 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 308 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 308 var src = resolver.resolveAbsolute(uri, actualUri); | 309 var src = resolver.resolveAbsolute(uri, actualUri); |
| 309 return src.exists() ? src : null; | 310 return src.exists() ? src : null; |
| 310 } | 311 } |
| 311 | 312 |
| 312 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); | 313 Uri restoreAbsolute(Source source) => resolver.restoreAbsolute(source); |
| 313 } | 314 } |
| 314 | 315 |
| 315 final _log = new Logger('dev_compiler.src.server'); | 316 final _log = new Logger('dev_compiler.src.server'); |
| 316 final _earlyErrorResult = new CheckerResults(const [], true); | 317 final _earlyErrorResult = new CheckerResults(const [], true); |
| OLD | NEW |