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 /// Command line tool to run the checker on a Dart program. | 5 /// Command line tool to run the checker on a Dart program. |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:convert' show JSON; | 9 import 'dart:convert' show JSON; |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 scriptSource = context.sourceFactory.resolveUri(source, srcAttr); | 297 scriptSource = context.sourceFactory.resolveUri(source, srcAttr); |
298 } | 298 } |
299 | 299 |
300 if (scriptSource != null) { | 300 if (scriptSource != null) { |
301 var lib = context.computeLibraryElement(scriptSource); | 301 var lib = context.computeLibraryElement(scriptSource); |
302 _compileLibrary(lib, notifier); | 302 _compileLibrary(lib, notifier); |
303 script.replaceWith(_linkLibraries(lib, loadedLibs, from: htmlOutDir)); | 303 script.replaceWith(_linkLibraries(lib, loadedLibs, from: htmlOutDir)); |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 new File(getOutputPath(source.uri)).openSync(mode: FileMode.WRITE) | 307 var outputFile = getOutputPath(source.uri); |
308 ..writeStringSync(document.outerHtml) | 308 new File(outputFile) |
309 ..writeStringSync('\n') | 309 ..createSync(recursive: true) |
310 ..closeSync(); | 310 ..writeAsStringSync(document.outerHtml + '\n'); |
311 } | 311 } |
312 | 312 |
313 html.DocumentFragment _linkLibraries( | 313 html.DocumentFragment _linkLibraries( |
314 LibraryElement mainLib, LinkedHashSet<Uri> loaded, | 314 LibraryElement mainLib, LinkedHashSet<Uri> loaded, |
315 {String from}) { | 315 {String from}) { |
316 assert(from != null); | 316 assert(from != null); |
317 var alreadyLoaded = loaded.length; | 317 var alreadyLoaded = loaded.length; |
318 _collectLibraries(mainLib, loaded); | 318 _collectLibraries(mainLib, loaded); |
319 | 319 |
320 var newLibs = loaded.skip(alreadyLoaded); | 320 var newLibs = loaded.skip(alreadyLoaded); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 var files = [ | 548 var files = [ |
549 'harmony_feature_check.js', | 549 'harmony_feature_check.js', |
550 'dart_library.js', | 550 'dart_library.js', |
551 'dart/_runtime.js', | 551 'dart/_runtime.js', |
552 ]; | 552 ]; |
553 files.addAll(corelibOrder.map(coreToFile)); | 553 files.addAll(corelibOrder.map(coreToFile)); |
554 return files; | 554 return files; |
555 }(); | 555 }(); |
556 | 556 |
557 final _log = new Logger('dev_compiler.src.compiler'); | 557 final _log = new Logger('dev_compiler.src.compiler'); |
OLD | NEW |