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

Unified Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 2100553003: Token of an empty comment reference should end with EOF. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/parser.dart
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index c90928f8fc26bd1fafc715eb46010b02bfd9d3c7..748fbba36af05e1edab0d3f958fad8723dab227a 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -5033,11 +5033,6 @@ class Parser {
String referenceSource, int sourceOffset) {
// TODO(brianwilkerson) The errors are not getting the right offset/length
// and are being duplicated.
- if (referenceSource.length == 0) {
- Token syntheticToken =
- new SyntheticStringToken(TokenType.IDENTIFIER, "", sourceOffset);
- return new CommentReference(null, new SimpleIdentifier(syntheticToken));
- }
try {
BooleanErrorListener listener = new BooleanErrorListener();
Scanner scanner = new Scanner(
@@ -5047,6 +5042,12 @@ class Parser {
if (listener.errorReported) {
return null;
}
+ if (firstToken.type == TokenType.EOF) {
+ Token syntheticToken =
+ new SyntheticStringToken(TokenType.IDENTIFIER, "", sourceOffset);
+ syntheticToken.setNext(firstToken);
+ return new CommentReference(null, new SimpleIdentifier(syntheticToken));
+ }
Token newKeyword = null;
if (_tokenMatchesKeyword(firstToken, Keyword.NEW)) {
newKeyword = firstToken;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698