| 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:kernel/kernel.dart'; | 9 import 'package:kernel/kernel.dart'; |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 /// [computeDelta]. | 49 /// [computeDelta]. |
| 50 /// | 50 /// |
| 51 /// Behavior is undefined if the client does not obey the following concurrency | 51 /// Behavior is undefined if the client does not obey the following concurrency |
| 52 /// restrictions: | 52 /// restrictions: |
| 53 /// - no two invocations of [computeDelta] may be outstanding at any given time. | 53 /// - no two invocations of [computeDelta] may be outstanding at any given time. |
| 54 /// - neither [invalidate] nor [invalidateAll] may be called while an invocation | 54 /// - neither [invalidate] nor [invalidateAll] may be called while an invocation |
| 55 /// of [computeDelta] is outstanding. | 55 /// of [computeDelta] is outstanding. |
| 56 /// | 56 /// |
| 57 /// Not intended to be implemented or extended by clients. | 57 /// Not intended to be implemented or extended by clients. |
| 58 abstract class IncrementalKernelGenerator { | 58 abstract class IncrementalKernelGenerator { |
| 59 /// Creates an [IncrementalKernelGenerator] which is prepared to generate | |
| 60 /// kernel representations of the program whose main library is in the given | |
| 61 /// [source]. | |
| 62 /// | |
| 63 /// No file system access is performed by this constructor; the initial | |
| 64 /// "previous program state" is an empty program containing no code, and the | |
| 65 /// initial set of valid sources is empty. To obtain a kernel representation | |
| 66 /// of the program, call [computeDelta]. | |
| 67 factory IncrementalKernelGenerator(Uri source, CompilerOptions options) => | |
| 68 new IncrementalKernelGeneratorImpl(source, new ProcessedOptions(options)); | |
| 69 | |
| 70 /// Generates a kernel representation of the changes to the program, assuming | 59 /// Generates a kernel representation of the changes to the program, assuming |
| 71 /// that all valid sources are unchanged since the last call to | 60 /// that all valid sources are unchanged since the last call to |
| 72 /// [computeDelta]. | 61 /// [computeDelta]. |
| 73 /// | 62 /// |
| 74 /// Source files in the set of valid sources are guaranteed not to be re-read | 63 /// Source files in the set of valid sources are guaranteed not to be re-read |
| 75 /// from disk; they are assumed to be unchanged regardless of the state of the | 64 /// from disk; they are assumed to be unchanged regardless of the state of the |
| 76 /// filesystem. | 65 /// filesystem. |
| 77 /// | 66 /// |
| 78 /// If [watch] is not `null`, then when a source file is first used | 67 /// If [watch] is not `null`, then when a source file is first used |
| 79 /// by [computeDelta], [watch] is called with the Uri of that source | 68 /// by [computeDelta], [watch] is called with the Uri of that source |
| (...skipping 21 matching lines...) Expand all Loading... |
| 101 void invalidate(Uri uri); | 90 void invalidate(Uri uri); |
| 102 | 91 |
| 103 /// Remove all source files from the set of valid sources. This guarantees | 92 /// Remove all source files from the set of valid sources. This guarantees |
| 104 /// that all files will be re-read on the next call to [computeDelta]. | 93 /// that all files will be re-read on the next call to [computeDelta]. |
| 105 /// | 94 /// |
| 106 /// Note that this does not erase the previous program state; the next time | 95 /// Note that this does not erase the previous program state; the next time |
| 107 /// [computeDelta] is called, if parts of the program are discovered to be | 96 /// [computeDelta] is called, if parts of the program are discovered to be |
| 108 /// unchanged, parts of the previous program state will still be re-used to | 97 /// unchanged, parts of the previous program state will still be re-used to |
| 109 /// speed up compilation. | 98 /// speed up compilation. |
| 110 void invalidateAll(); | 99 void invalidateAll(); |
| 100 |
| 101 /// Creates an [IncrementalKernelGenerator] which is prepared to generate |
| 102 /// kernel representations of the program whose main library is in the given |
| 103 /// [entryPoint]. |
| 104 /// |
| 105 /// The initial "previous program state" is an empty program containing no |
| 106 /// code, and the initial set of valid sources is empty. To obtain a kernel |
| 107 /// representation of the program, call [computeDelta]. |
| 108 static Future<IncrementalKernelGenerator> newInstance( |
| 109 CompilerOptions options, Uri entryPoint) async { |
| 110 var processedOptions = new ProcessedOptions(options); |
| 111 var uriTranslator = await processedOptions.getUriTranslator(); |
| 112 return new IncrementalKernelGeneratorImpl( |
| 113 processedOptions, uriTranslator, entryPoint); |
| 114 } |
| 111 } | 115 } |
| OLD | NEW |