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:
Konstantin Shcheglov 2016-10-11 13:41:44 -07:00
parent e25461c151
commit 2a000e1587
2 changed files with 12 additions and 0 deletions

View file

@ -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) {

View file

@ -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) {