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

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

Issue 2914213003: fix unterminated interpolation expression handling (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « pkg/compiler/lib/src/tree/unparser.dart ('k') | pkg/front_end/test/scanner_fasta_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
diff --git a/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart b/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
index 756dea6601276417e187645441de0b2c9c766fe7..43159a580a7d1846560494432beb8c246720ea9f 100644
--- a/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
+++ b/pkg/front_end/lib/src/fasta/scanner/array_based_scanner.dart
@@ -279,15 +279,16 @@ abstract class ArrayBasedScanner extends AbstractScanner {
/**
* This method is called to discard '${' from the "grouping" stack.
*
- * This method is called when the scanner finds the end of a string
- * or an unterminated string.
+ * This method is called when the scanner finds an unterminated
+ * interpolation expression.
*/
void discardInterpolation() {
- if (groupingStack.isEmpty) return;
- BeginToken begin = groupingStack.head;
- if (begin.kind != STRING_INTERPOLATION_TOKEN) return;
- unmatchedBeginGroup(begin);
- groupingStack = groupingStack.tail;
+ while (!groupingStack.isEmpty) {
+ BeginToken beginToken = groupingStack.head;
+ unmatchedBeginGroup(beginToken);
+ groupingStack = groupingStack.tail;
+ if (identical(beginToken.kind, STRING_INTERPOLATION_TOKEN)) break;
+ }
}
void unmatchedBeginGroup(BeginToken begin) {
« no previous file with comments | « pkg/compiler/lib/src/tree/unparser.dart ('k') | pkg/front_end/test/scanner_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698