Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart

Issue 2869273006: Replace factory constructor with a static method for creating IncrementalKernelGenerator. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
diff --git a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
index 780852dfcb62b80e3885e65c1718588d0996fb9e..c19ed2adb848f614a596db84367d2c7ace247170 100644
--- a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -29,32 +29,33 @@ dynamic unimplemented() {
/// used to obtain resolved ASTs, and these are fed into kernel code generation
/// logic.
class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
- /// The URI of the program entry point.
- final Uri _entryPoint;
-
/// The compiler options, such as the [FileSystem], the SDK dill location,
/// etc.
final ProcessedOptions _options;
- /// The set of absolute file URIs that were reported through [invalidate]
- /// and not checked for actual changes yet.
- final Set<Uri> _invalidatedFiles = new Set<Uri>();
-
/// The object that knows how to resolve "package:" and "dart:" URIs.
- TranslateUri _uriTranslator;
+ final TranslateUri _uriTranslator;
/// The current file system state.
- FileSystemState _fsState;
+ final FileSystemState _fsState;
+
+ /// The URI of the program entry point.
+ final Uri _entryPoint;
+
+ /// The set of absolute file URIs that were reported through [invalidate]
+ /// and not checked for actual changes yet.
+ final Set<Uri> _invalidatedFiles = new Set<Uri>();
/// The cached SDK kernel.
DillTarget _sdkDillTarget;
- IncrementalKernelGeneratorImpl(this._entryPoint, this._options);
+ IncrementalKernelGeneratorImpl(
+ this._options, this._uriTranslator, this._entryPoint)
+ : _fsState = new FileSystemState(_options.fileSystem, _uriTranslator);
@override
Future<DeltaProgram> computeDelta(
{Future<Null> watch(Uri uri, bool used)}) async {
- await _initialize();
await _ensureVmLibrariesLoaded();
await _refreshInvalidatedFiles();
@@ -115,15 +116,6 @@ class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
return _sdkDillTarget;
}
- /// Ensure that asynchronous data from options is ready.
- ///
- /// Ideally this data should be prepared in the constructor, but constructors
- /// cannot be asynchronous.
- Future<Null> _initialize() async {
- _uriTranslator ??= await _options.getUriTranslator();
- _fsState ??= new FileSystemState(_options.fileSystem, _uriTranslator);
- }
-
/// Refresh all the invalidated files and update dependencies.
Future<Null> _refreshInvalidatedFiles() async {
for (Uri fileUri in _invalidatedFiles) {
« no previous file with comments | « pkg/front_end/lib/incremental_kernel_generator.dart ('k') | pkg/front_end/test/incremental_kernel_generator_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698