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