| 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 | 6 |
| 7 import 'package:front_end/incremental_kernel_generator.dart'; | 7 import 'package:front_end/incremental_kernel_generator.dart'; |
| 8 import 'package:front_end/src/base/performace_logger.dart'; | 8 import 'package:front_end/src/base/performace_logger.dart'; |
| 9 import 'package:front_end/src/base/processed_options.dart'; | 9 import 'package:front_end/src/base/processed_options.dart'; |
| 10 import 'package:front_end/src/fasta/uri_translator.dart'; | 10 import 'package:front_end/src/fasta/uri_translator.dart'; |
| 11 import 'package:front_end/src/incremental/file_state.dart'; | 11 import 'package:front_end/src/incremental/file_state.dart'; |
| 12 import 'package:front_end/src/incremental/kernel_driver.dart'; | 12 import 'package:front_end/src/incremental/kernel_driver.dart'; |
| 13 import 'package:kernel/kernel.dart' hide Source; | 13 import 'package:kernel/kernel.dart' hide Source; |
| 14 import 'package:kernel/target/targets.dart'; |
| 15 import 'package:kernel/target/vm_fasta.dart'; |
| 14 import 'package:meta/meta.dart'; | 16 import 'package:meta/meta.dart'; |
| 15 | 17 |
| 16 /// Implementation of [IncrementalKernelGenerator]. | 18 /// Implementation of [IncrementalKernelGenerator]. |
| 17 /// | 19 /// |
| 18 /// TODO(scheglov) Update the documentation. | 20 /// TODO(scheglov) Update the documentation. |
| 19 /// | 21 /// |
| 20 /// Theory of operation: an instance of [IncrementalResolvedAstGenerator] is | 22 /// Theory of operation: an instance of [IncrementalResolvedAstGenerator] is |
| 21 /// used to obtain resolved ASTs, and these are fed into kernel code generation | 23 /// used to obtain resolved ASTs, and these are fed into kernel code generation |
| 22 /// logic. | 24 /// logic. |
| 23 class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator { | 25 class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 _watchFn = watch { | 51 _watchFn = watch { |
| 50 _testView = new _TestView(this); | 52 _testView = new _TestView(this); |
| 51 | 53 |
| 52 Future<Null> onFileAdded(Uri uri) { | 54 Future<Null> onFileAdded(Uri uri) { |
| 53 if (_watchFn != null) { | 55 if (_watchFn != null) { |
| 54 return _watchFn(uri, true); | 56 return _watchFn(uri, true); |
| 55 } | 57 } |
| 56 return new Future.value(); | 58 return new Future.value(); |
| 57 } | 59 } |
| 58 | 60 |
| 59 _driver = new KernelDriver(_logger, options.fileSystem, options.byteStore, | 61 _driver = new KernelDriver( |
| 60 uriTranslator, options.strongMode, | 62 _logger, |
| 63 options.fileSystem, |
| 64 options.byteStore, |
| 65 uriTranslator, |
| 66 new VmFastaTarget(new TargetFlags(strongMode: options.strongMode)), |
| 61 fileAddedFn: onFileAdded); | 67 fileAddedFn: onFileAdded); |
| 62 } | 68 } |
| 63 | 69 |
| 64 /// Return the object that provides additional information for tests. | 70 /// Return the object that provides additional information for tests. |
| 65 @visibleForTesting | 71 @visibleForTesting |
| 66 _TestView get test => _testView; | 72 _TestView get test => _testView; |
| 67 | 73 |
| 68 @override | 74 @override |
| 69 Future<DeltaProgram> computeDelta() async { | 75 Future<DeltaProgram> computeDelta() async { |
| 70 return await _logger.runAsync('Compute delta', () async { | 76 return await _logger.runAsync('Compute delta', () async { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 155 |
| 150 @visibleForTesting | 156 @visibleForTesting |
| 151 class _TestView { | 157 class _TestView { |
| 152 final IncrementalKernelGeneratorImpl _generator; | 158 final IncrementalKernelGeneratorImpl _generator; |
| 153 | 159 |
| 154 _TestView(this._generator); | 160 _TestView(this._generator); |
| 155 | 161 |
| 156 /// The [KernelDriver] that is used to actually compile. | 162 /// The [KernelDriver] that is used to actually compile. |
| 157 KernelDriver get driver => _generator._driver; | 163 KernelDriver get driver => _generator._driver; |
| 158 } | 164 } |
| OLD | NEW |