Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:front_end/file_system.dart'; | 8 import 'package:front_end/file_system.dart'; |
| 9 import 'package:front_end/incremental_kernel_generator.dart'; | 9 import 'package:front_end/incremental_kernel_generator.dart'; |
| 10 import 'package:front_end/src/base/api_signature.dart'; | 10 import 'package:front_end/src/base/api_signature.dart'; |
| 11 import 'package:front_end/src/base/performace_logger.dart'; | 11 import 'package:front_end/src/base/performace_logger.dart'; |
| 12 import 'package:front_end/src/base/processed_options.dart'; | 12 import 'package:front_end/src/base/processed_options.dart'; |
| 13 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; | 13 import 'package:front_end/src/fasta/dill/dill_library_builder.dart'; |
| 14 import 'package:front_end/src/fasta/dill/dill_target.dart'; | 14 import 'package:front_end/src/fasta/dill/dill_target.dart'; |
| 15 import 'package:front_end/src/fasta/kernel/kernel_target.dart'; | 15 import 'package:front_end/src/fasta/kernel/kernel_target.dart'; |
| 16 import 'package:front_end/src/fasta/ticker.dart'; | 16 import 'package:front_end/src/fasta/ticker.dart'; |
| 17 import 'package:front_end/src/fasta/translate_uri.dart'; | 17 import 'package:front_end/src/fasta/translate_uri.dart'; |
| 18 import 'package:front_end/src/incremental/byte_store.dart'; | 18 import 'package:front_end/src/incremental/byte_store.dart'; |
| 19 import 'package:front_end/src/incremental/file_state.dart'; | 19 import 'package:front_end/src/incremental/file_state.dart'; |
| 20 import 'package:kernel/binary/ast_from_binary.dart'; | 20 import 'package:kernel/binary/ast_from_binary.dart'; |
| 21 import 'package:kernel/binary/limited_ast_to_binary.dart'; | 21 import 'package:kernel/binary/limited_ast_to_binary.dart'; |
| 22 import 'package:kernel/kernel.dart' hide Source; | 22 import 'package:kernel/kernel.dart' hide Source; |
| 23 import 'package:kernel/target/targets.dart' show TargetFlags; | 23 import 'package:kernel/target/targets.dart' show TargetFlags; |
| 24 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; | 24 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
| 25 | 25 |
| 26 dynamic unimplemented() { | |
| 27 // TODO(paulberry): get rid of this. | |
| 28 throw new UnimplementedError(); | |
| 29 } | |
| 30 | |
| 31 class ByteSink implements Sink<List<int>> { | 26 class ByteSink implements Sink<List<int>> { |
| 32 final BytesBuilder builder = new BytesBuilder(); | 27 final BytesBuilder builder = new BytesBuilder(); |
| 33 | 28 |
| 34 void add(List<int> data) { | 29 void add(List<int> data) { |
| 35 builder.add(data); | 30 builder.add(data); |
| 36 } | 31 } |
| 37 | 32 |
| 38 void close() {} | 33 void close() {} |
| 39 } | 34 } |
| 40 | 35 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 for (Library library in result.kernelLibraries) { | 118 for (Library library in result.kernelLibraries) { |
| 124 Uri uri = library.importUri; | 119 Uri uri = library.importUri; |
| 125 if (_latestSignature[uri] != result.signature) { | 120 if (_latestSignature[uri] != result.signature) { |
| 126 _latestSignature[uri] = result.signature; | 121 _latestSignature[uri] = result.signature; |
| 127 program.libraries.add(library); | 122 program.libraries.add(library); |
| 128 library.parent = program; | 123 library.parent = program; |
| 129 } | 124 } |
| 130 } | 125 } |
| 131 } | 126 } |
| 132 | 127 |
| 128 if (watch != null) _fsState.trackedFiles.forEach((f) => watch(f, true)); | |
| 129 | |
| 133 // TODO(scheglov) Add libraries which import changed libraries. | 130 // TODO(scheglov) Add libraries which import changed libraries. |
| 134 // For now the corresponding test works because we use full library | 131 // For now the corresponding test works because we use full library |
| 135 // contents to compute signatures (not just API parts). So, every library | 132 // contents to compute signatures (not just API parts). So, every library |
| 136 // that imports a changed one, is affected. | 133 // that imports a changed one, is affected. |
| 137 | 134 |
| 138 return new DeltaProgram(program); | 135 return new DeltaProgram(program); |
| 139 }); | 136 }); |
| 140 } | 137 } |
| 141 | 138 |
| 142 @override | 139 @override |
| 143 void invalidate(Uri uri) { | 140 void invalidate(Uri uri) { |
| 144 _invalidatedFiles.add(uri); | 141 _invalidatedFiles.add(uri); |
| 145 } | 142 } |
| 146 | 143 |
| 147 @override | 144 @override |
| 148 void invalidateAll() => unimplemented(); | 145 void invalidateAll() { |
| 146 _invalidatedFiles.addAll(_fsState.trackedFiles); | |
|
scheglov
2017/06/07 01:04:42
Please add a test.
Siggi Cherem (dart-lang)
2017/06/07 20:17:11
Done.
| |
| 147 } | |
| 149 | 148 |
| 150 /// Ensure that [dillTarget] includes the [cycle] libraries. It already | 149 /// Ensure that [dillTarget] includes the [cycle] libraries. It already |
| 151 /// contains all the libraries that sorted before the given [cycle] in | 150 /// contains all the libraries that sorted before the given [cycle] in |
| 152 /// topological order. Return the result with the cycle libraries. | 151 /// topological order. Return the result with the cycle libraries. |
| 153 Future<_LibraryCycleResult> _compileCycle( | 152 Future<_LibraryCycleResult> _compileCycle( |
| 154 CanonicalName nameRoot, DillTarget dillTarget, LibraryCycle cycle) async { | 153 CanonicalName nameRoot, DillTarget dillTarget, LibraryCycle cycle) async { |
| 155 return _logger.runAsync('Compile cycle $cycle', () async { | 154 return _logger.runAsync('Compile cycle $cycle', () async { |
| 156 String signature; | 155 String signature; |
| 157 { | 156 { |
| 158 var signatureBuilder = new ApiSignature(); | 157 var signatureBuilder = new ApiSignature(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 /// TODO(scheglov) Use API signatures. | 309 /// TODO(scheglov) Use API signatures. |
| 311 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. | 310 /// TODO(scheglov) Or use tree shaking and compute signatures of outlines. |
| 312 final String signature; | 311 final String signature; |
| 313 | 312 |
| 314 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies | 313 /// Kernel libraries for libraries in the [cycle]. Bodies of dependencies |
| 315 /// are not included, but but references to those dependencies are included. | 314 /// are not included, but but references to those dependencies are included. |
| 316 final List<Library> kernelLibraries; | 315 final List<Library> kernelLibraries; |
| 317 | 316 |
| 318 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); | 317 _LibraryCycleResult(this.cycle, this.signature, this.kernelLibraries); |
| 319 } | 318 } |
| OLD | NEW |