Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: pkg/front_end/lib/src/fasta/scanner/recover.dart

Issue 2767083002: fasta scanner recovery and error code translation improvements (Closed)
Patch Set: revert address comments and fix for token_stream_rewriter test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/scanner/recover.dart
diff --git a/pkg/front_end/lib/src/fasta/scanner/recover.dart b/pkg/front_end/lib/src/fasta/scanner/recover.dart
index 9e069a63f30d1870184287ae50f02f2ea60c5dcc..44763f85a5786eed922354cd88b1c44f3c023e7f 100644
--- a/pkg/front_end/lib/src/fasta/scanner/recover.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/recover.dart
@@ -4,7 +4,7 @@
library fasta.scanner.recover;
-import 'token.dart' show StringToken, Token;
+import 'token.dart' show StringToken, SymbolToken, Token;
import 'error_token.dart' show NonAsciiIdentifierToken, ErrorKind, ErrorToken;
@@ -155,6 +155,7 @@ Token defaultRecoveryStrategy(
error = next;
} else {
errorTail.next = next;
+ next.previousToken = errorTail;
}
errorTail = next;
next = next.next;
@@ -213,12 +214,23 @@ Token defaultRecoveryStrategy(
good = current;
} else {
goodTail.next = current;
+ current.previousToken = goodTail;
}
beforeGoodTail = goodTail;
goodTail = current;
}
- errorTail.next = good;
+ error.previousToken = new SymbolToken.eof(-1)..next = error;
+ Token tail;
+ if (good != null) {
+ errorTail.next = good;
+ good.previousToken = errorTail;
+ tail = goodTail;
+ } else {
+ tail = errorTail;
+ }
+ if (!tail.isEof)
+ tail.next = new SymbolToken.eof(tail.end)..previousToken = tail;
return error;
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart ('k') | pkg/front_end/lib/src/fasta/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698