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 5f2d0b47ddc1357e9b27c3999b6dd0341bd5557d..96d278c4f3f895719bbe27c2738a53fc3926d381 100644 |
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart |
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart |
@@ -4077,7 +4077,10 @@ class NodeLocator2 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; |