mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:39:49 +00:00
Issue 27539. Check that the source is not modified between constructor and correction computing.
R=brianwilkerson@google.com BUG= https://github.com/dart-lang/sdk/issues/27539 Review URL: https://codereview.chromium.org/2411063002 .
This commit is contained in:
parent
e25461c151
commit
2a000e1587
|
@ -87,6 +87,12 @@ class AssistProcessor {
|
|||
String get eol => utils.endOfLine;
|
||||
|
||||
Future<List<Assist>> compute() async {
|
||||
// If the source was changed between the constructor and running
|
||||
// this asynchronous method, it is not safe to use the unit.
|
||||
if (analysisContext.getModificationStamp(source) != fileStamp) {
|
||||
return const <Assist>[];
|
||||
}
|
||||
|
||||
try {
|
||||
utils = new CorrectionUtils(unit);
|
||||
} catch (e) {
|
||||
|
|
|
@ -139,6 +139,12 @@ class FixProcessor {
|
|||
String get eol => utils.endOfLine;
|
||||
|
||||
Future<List<Fix>> compute() async {
|
||||
// If the source was changed between the constructor and running
|
||||
// this asynchronous method, it is not safe to use the unit.
|
||||
if (context.getModificationStamp(unitSource) != fileStamp) {
|
||||
return const <Fix>[];
|
||||
}
|
||||
|
||||
try {
|
||||
utils = new CorrectionUtils(unit);
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in a new issue