Index: pkg/analyzer/lib/src/dart/ast/utilities.dart |
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart |
index dc303a376d86f22bb5af790a49558326be638be6..ccb388e64c02c03fe1b9925bdbfb846dc2eea667 100644 |
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart |
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart |
@@ -3977,7 +3977,10 @@ class NodeLocator extends UnifyingAstVisitor<Object> { |
Token endToken = node.endToken; |
// Don't include synthetic tokens. |
while (endToken != beginToken) { |
- if (endToken.type == TokenType.EOF || !endToken.isSynthetic) { |
+ // Fasta scanner reports unterminated string literal errors |
+ // and generates a synthetic string token with non-zero length. |
+ // Because of this, check for length > 0 rather than !isSynthetic. |
+ if (endToken.type == TokenType.EOF || endToken.length > 0) { |
break; |
} |
endToken = endToken.previous; |