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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 new IncrementalKernelGeneratorImpl(source, new ProcessedOptions(options)); | 59 new IncrementalKernelGeneratorImpl(source, new ProcessedOptions(options)); |
60 | 60 |
61 /// Generates a kernel representation of the changes to the program, assuming | 61 /// Generates a kernel representation of the changes to the program, assuming |
62 /// that all valid sources are unchanged since the last call to | 62 /// that all valid sources are unchanged since the last call to |
63 /// [computeDelta]. | 63 /// [computeDelta]. |
64 /// | 64 /// |
65 /// Source files in the set of valid sources are guaranteed not to be re-read | 65 /// Source files in the set of valid sources are guaranteed not to be re-read |
66 /// from disk; they are assumed to be unchanged regardless of the state of the | 66 /// from disk; they are assumed to be unchanged regardless of the state of the |
67 /// filesystem. | 67 /// filesystem. |
68 /// | 68 /// |
| 69 /// If [watch] is not `null`, then when a source file is first used |
| 70 /// by [computeDelta], [watch] is called with the Uri of that source |
| 71 /// file and `used` == `true` indicating that the source file is being |
| 72 /// used when compiling the program. The content of the file is not read |
| 73 /// until the Future returned by [watch] completes. If during a subsequent |
| 74 /// call to [computeDelta], a source file that was being used is no longer |
| 75 /// used, then [watch] is called with the Uri of that source file and |
| 76 /// `used` == `false` indicating that the source file is no longer needed. |
| 77 /// Multiple invocations of [watch] may be running concurrently. |
| 78 /// |
69 /// If the future completes successfully, the previous file state is updated | 79 /// If the future completes successfully, the previous file state is updated |
70 /// and the set of valid sources is set to the set of all sources in the | 80 /// and the set of valid sources is set to the set of all sources in the |
71 /// program. | 81 /// program. |
72 /// | 82 /// |
73 /// If the future completes with an error (due to errors in the compiled | 83 /// If the future completes with an error (due to errors in the compiled |
74 /// source code), the caller may consider the previous file state and the set | 84 /// source code), the caller may consider the previous file state and the set |
75 /// of valid sources to be unchanged; this means that once the user fixes the | 85 /// of valid sources to be unchanged; this means that once the user fixes the |
76 /// errors, it is safe to call [computeDelta] again. | 86 /// errors, it is safe to call [computeDelta] again. |
77 Future<DeltaProgram> computeDelta(); | 87 Future<DeltaProgram> computeDelta({Future<Null> watch(Uri uri, bool used)}); |
78 | 88 |
79 /// Remove any source file(s) associated with the given file path from the set | 89 /// Remove any source file(s) associated with the given file path from the set |
80 /// of valid sources. This guarantees that those files will be re-read on the | 90 /// of valid sources. This guarantees that those files will be re-read on the |
81 /// next call to [computeDelta]). | 91 /// next call to [computeDelta]). |
82 void invalidate(String path); | 92 void invalidate(String path); |
83 | 93 |
84 /// Remove all source files from the set of valid sources. This guarantees | 94 /// Remove all source files from the set of valid sources. This guarantees |
85 /// that all files will be re-read on the next call to [computeDelta]. | 95 /// that all files will be re-read on the next call to [computeDelta]. |
86 /// | 96 /// |
87 /// Note that this does not erase the previous program state; the next time | 97 /// Note that this does not erase the previous program state; the next time |
88 /// [computeDelta] is called, if parts of the program are discovered to be | 98 /// [computeDelta] is called, if parts of the program are discovered to be |
89 /// unchanged, parts of the previous program state will still be re-used to | 99 /// unchanged, parts of the previous program state will still be re-used to |
90 /// speed up compilation. | 100 /// speed up compilation. |
91 void invalidateAll(); | 101 void invalidateAll(); |
92 } | 102 } |
OLD | NEW |