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/src/base/processed_options.dart'; | 7 import 'package:front_end/src/base/processed_options.dart'; |
8 import 'package:front_end/src/incremental_kernel_generator_impl.dart'; | 8 import 'package:front_end/src/incremental_kernel_generator_impl.dart'; |
9 import 'package:front_end/src/fasta/compiler_context.dart'; | |
10 import 'package:kernel/kernel.dart'; | 9 import 'package:kernel/kernel.dart'; |
11 | 10 |
12 import 'compiler_options.dart'; | 11 import 'compiler_options.dart'; |
13 | 12 |
14 /// The type of the function that clients can pass to track used files. | 13 /// The type of the function that clients can pass to track used files. |
15 /// | 14 /// |
16 /// When a file is first used during compilation, this function is called with | 15 /// When a file is first used during compilation, this function is called with |
17 /// the [Uri] of that file and [used] == `true`. The content of the file is not | 16 /// the [Uri] of that file and [used] == `true`. The content of the file is not |
18 /// read until the [Future] returned by the function completes. If, during a | 17 /// read until the [Future] returned by the function completes. If, during a |
19 /// subsequent compilation, a file that was being used is no longer used, then | 18 /// subsequent compilation, a file that was being used is no longer used, then |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 /// kernel representations of the program whose main library is in the given | 93 /// kernel representations of the program whose main library is in the given |
95 /// [entryPoint]. | 94 /// [entryPoint]. |
96 /// | 95 /// |
97 /// The initial "previous program state" is an empty program containing no | 96 /// The initial "previous program state" is an empty program containing no |
98 /// code, and the initial set of valid sources is empty. To obtain a kernel | 97 /// code, and the initial set of valid sources is empty. To obtain a kernel |
99 /// representation of the program, call [computeDelta]. | 98 /// representation of the program, call [computeDelta]. |
100 static Future<IncrementalKernelGenerator> newInstance( | 99 static Future<IncrementalKernelGenerator> newInstance( |
101 CompilerOptions options, Uri entryPoint, | 100 CompilerOptions options, Uri entryPoint, |
102 {WatchUsedFilesFn watch}) async { | 101 {WatchUsedFilesFn watch}) async { |
103 var processedOptions = new ProcessedOptions(options, false, [entryPoint]); | 102 var processedOptions = new ProcessedOptions(options, false, [entryPoint]); |
104 return await CompilerContext.runWithOptions(processedOptions, (_) async { | 103 var uriTranslator = await processedOptions.getUriTranslator(); |
105 var uriTranslator = await processedOptions.getUriTranslator(); | 104 return new IncrementalKernelGeneratorImpl( |
106 return new IncrementalKernelGeneratorImpl( | 105 processedOptions, uriTranslator, entryPoint, |
107 processedOptions, uriTranslator, entryPoint, | 106 watch: watch); |
108 watch: watch); | |
109 }); | |
110 } | 107 } |
111 } | 108 } |
OLD | NEW |