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

Unified Diff: pkg/analyzer/lib/src/fasta/token_utils.dart

Issue 2792053002: Scan generic method comments with Fasta. (Closed)
Patch Set: Created 3 years, 9 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/front_end/lib/src/fasta/scanner/abstract_scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/fasta/token_utils.dart
diff --git a/pkg/analyzer/lib/src/fasta/token_utils.dart b/pkg/analyzer/lib/src/fasta/token_utils.dart
index 1e26cbe725486b5963efe2c68343990a5b17e270..44cf694bfbd2a01278f02d81293e0c14929b0d33 100644
--- a/pkg/analyzer/lib/src/fasta/token_utils.dart
+++ b/pkg/analyzer/lib/src/fasta/token_utils.dart
@@ -167,11 +167,18 @@ class ToAnalyzerTokenStreamConverter {
/// Converts a single Fasta comment token to an analyzer comment token.
analyzer.CommentToken toAnalyzerCommentToken(Token token) {
- // TODO(paulberry,ahe): It would be nice if the scanner gave us an
- // easier way to distinguish between the two types of comment.
- var type = token.lexeme.startsWith('/*')
- ? TokenType.MULTI_LINE_COMMENT
- : TokenType.SINGLE_LINE_COMMENT;
+ TokenType type;
+ if (token.type == GENERIC_METHOD_TYPE_ASSIGN) {
+ type = TokenType.GENERIC_METHOD_TYPE_ASSIGN;
+ } else if (token.type == GENERIC_METHOD_TYPE_LIST) {
+ type = TokenType.GENERIC_METHOD_TYPE_LIST;
+ } else {
+ // TODO(paulberry,ahe): It would be nice if the scanner gave us an
+ // easier way to distinguish between the two types of comment.
+ type = token.lexeme.startsWith('/*')
+ ? TokenType.MULTI_LINE_COMMENT
+ : TokenType.SINGLE_LINE_COMMENT;
+ }
return new analyzer.CommentToken(type, token.lexeme, token.charOffset);
}
@@ -731,10 +738,10 @@ TokenType getTokenType(Token token) {
return TokenType.BACKSLASH;
case PERIOD_PERIOD_PERIOD_TOKEN:
return TokenType.PERIOD_PERIOD_PERIOD;
- // case GENERIC_METHOD_TYPE_LIST_TOKEN:
- // return TokenType.GENERIC_METHOD_TYPE_LIST;
- // case GENERIC_METHOD_TYPE_ASSIGN_TOKEN:
- // return TokenType.GENERIC_METHOD_TYPE_ASSIGN;
+ case GENERIC_METHOD_TYPE_LIST_TOKEN:
+ return TokenType.GENERIC_METHOD_TYPE_LIST;
+ case GENERIC_METHOD_TYPE_ASSIGN_TOKEN:
+ return TokenType.GENERIC_METHOD_TYPE_ASSIGN;
default:
return internalError("Unhandled token ${token.info}");
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/scanner/abstract_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698