| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 checker.visitCompilationUnit(unit); | 166 checker.visitCompilationUnit(unit); |
| 167 if (checker.failure) failureInLib = true; | 167 if (checker.failure) failureInLib = true; |
| 168 } | 168 } |
| 169 | 169 |
| 170 if (failureInLib) { | 170 if (failureInLib) { |
| 171 _failure = true; | 171 _failure = true; |
| 172 if (!options.codegenOptions.forceCompile) return; | 172 if (!options.codegenOptions.forceCompile) return; |
| 173 } | 173 } |
| 174 | 174 |
| 175 if (_jsGen != null) { | 175 if (_jsGen != null) { |
| 176 // TODO(jmesserly): full incremental support would avoid checking as well, | |
| 177 // however, we'd lose compiler messages in that case. | |
| 178 | |
| 179 // Note: analyzer's modification stamp is millisecondsSinceEpoch | |
| 180 int lastModifyTime = unitElements | |
| 181 .map((e) => context.getModificationStamp(e.source)) | |
| 182 .reduce(math.max); | |
| 183 var outFile = new File(getOutputPath(library.source.uri)); | |
| 184 if (outFile.existsSync() && | |
| 185 outFile.lastModifiedSync().millisecondsSinceEpoch >= lastModifyTime) { | |
| 186 // Output already up to date. | |
| 187 return; | |
| 188 } | |
| 189 | |
| 190 var unit = units.first; | 176 var unit = units.first; |
| 191 var parts = units.skip(1).toList(); | 177 var parts = units.skip(1).toList(); |
| 192 _jsGen.generateLibrary(new LibraryUnit(unit, parts)); | 178 _jsGen.generateLibrary(new LibraryUnit(unit, parts)); |
| 193 } | 179 } |
| 194 } | 180 } |
| 195 | 181 |
| 196 void _copyDartRuntime() { | 182 void _copyDartRuntime() { |
| 197 if (_sdkCopied) return; | 183 if (_sdkCopied) return; |
| 198 _sdkCopied = true; | 184 _sdkCopied = true; |
| 199 for (var file in defaultRuntimeFiles) { | 185 for (var file in defaultRuntimeFiles) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 '_rtti.js', | 454 '_rtti.js', |
| 469 '_classes.js', | 455 '_classes.js', |
| 470 '_operations.js', | 456 '_operations.js', |
| 471 'dart_runtime.js', | 457 'dart_runtime.js', |
| 472 ]; | 458 ]; |
| 473 files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js')); | 459 files.addAll(corelibOrder.map((l) => l.replaceAll('.', '/') + '.js')); |
| 474 return files; | 460 return files; |
| 475 }(); | 461 }(); |
| 476 | 462 |
| 477 final _log = new Logger('dev_compiler.src.compiler'); | 463 final _log = new Logger('dev_compiler.src.compiler'); |
| OLD | NEW |