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