| 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 library dev_compiler.src.compiler; | 6 library dev_compiler.src.compiler; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:collection'; | 9 import 'dart:collection'; |
| 10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 new File(getOutputPath(source.uri)).openSync(mode: FileMode.WRITE) | 192 new File(getOutputPath(source.uri)).openSync(mode: FileMode.WRITE) |
| 193 ..writeStringSync(document.outerHtml) | 193 ..writeStringSync(document.outerHtml) |
| 194 ..writeStringSync('\n') | 194 ..writeStringSync('\n') |
| 195 ..closeSync(); | 195 ..closeSync(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 html.DocumentFragment _linkLibraries( | 198 html.DocumentFragment _linkLibraries( |
| 199 LibraryElement mainLib, LinkedHashSet<Uri> loaded, {String from}) { | 199 LibraryElement mainLib, LinkedHashSet<Uri> loaded, |
| 200 {String from}) { |
| 200 assert(from != null); | 201 assert(from != null); |
| 201 var alreadyLoaded = loaded.length; | 202 var alreadyLoaded = loaded.length; |
| 202 _collectLibraries(mainLib, loaded); | 203 _collectLibraries(mainLib, loaded); |
| 203 | 204 |
| 204 var newLibs = loaded.skip(alreadyLoaded); | 205 var newLibs = loaded.skip(alreadyLoaded); |
| 205 var df = new html.DocumentFragment(); | 206 var df = new html.DocumentFragment(); |
| 206 | 207 |
| 207 for (var uri in newLibs) { | 208 for (var uri in newLibs) { |
| 208 if (uri.scheme == 'dart') { | 209 if (uri.scheme == 'dart') { |
| 209 if (uri.path == 'core') { | 210 if (uri.path == 'core') { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 while (len > 0 && common[len - 1] != segments[len - 1]) { | 298 while (len > 0 && common[len - 1] != segments[len - 1]) { |
| 298 len--; | 299 len--; |
| 299 } | 300 } |
| 300 common.length = len; | 301 common.length = len; |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 _inputBaseDir = common == null ? '' : path.joinAll(common); | 304 _inputBaseDir = common == null ? '' : path.joinAll(common); |
| 304 } | 305 } |
| 305 return _inputBaseDir; | 306 return _inputBaseDir; |
| 306 } | 307 } |
| 308 |
| 307 String _inputBaseDir; | 309 String _inputBaseDir; |
| 308 | 310 |
| 309 String getOutputPath(Uri uri) => path.join(outputDir, getModulePath(uri)); | 311 String getOutputPath(Uri uri) => path.join(outputDir, getModulePath(uri)); |
| 310 | 312 |
| 311 /// Like [getModuleName] but includes the file extension, either .js or .html. | 313 /// Like [getModuleName] but includes the file extension, either .js or .html. |
| 312 String getModulePath(Uri uri) { | 314 String getModulePath(Uri uri) { |
| 313 var ext = path.extension(uri.path); | 315 var ext = path.extension(uri.path); |
| 314 if (ext == '.dart' || ext == '' && uri.scheme == 'dart') ext = '.js'; | 316 if (ext == '.dart' || ext == '' && uri.scheme == 'dart') ext = '.js'; |
| 315 return getModuleName(uri) + ext; | 317 return getModuleName(uri) + ext; |
| 316 } | 318 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 '_rtti.js', | 413 '_rtti.js', |
| 412 '_classes.js', | 414 '_classes.js', |
| 413 '_operations.js', | 415 '_operations.js', |
| 414 'dart_runtime.js', | 416 'dart_runtime.js', |
| 415 ]; | 417 ]; |
| 416 files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js')); | 418 files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js')); |
| 417 return files; | 419 return files; |
| 418 }(); | 420 }(); |
| 419 | 421 |
| 420 final _log = new Logger('dev_compiler.src.compiler'); | 422 final _log = new Logger('dev_compiler.src.compiler'); |
| OLD | NEW |