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

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

Issue 2168833003: Support references to operators in doc comments (issue 26929) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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
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 6e45c8e1441a3cd3455a5f15f362506ea7e214c5..f63bb70615a521d647311d2c4335ae9acddaa1a5 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -5049,16 +5049,52 @@ class Parser {
newKeyword = firstToken;
firstToken = firstToken.next;
}
- if (_tokenMatchesIdentifier(firstToken)) {
+ if (firstToken.isUserDefinableOperator) {
+ if (firstToken.next.type != TokenType.EOF) {
+ return null;
+ }
+ Identifier identifier = new SimpleIdentifier(firstToken);
+ return new CommentReference(null, identifier);
+ } else if (_tokenMatchesKeyword(firstToken, Keyword.OPERATOR)) {
+ Token secondToken = firstToken.next;
+ if (secondToken.isUserDefinableOperator) {
+ if (secondToken.next.type != TokenType.EOF) {
+ return null;
+ }
+ Identifier identifier = new SimpleIdentifier(secondToken);
+ return new CommentReference(null, identifier);
+ }
+ return null;
+ } else if (_tokenMatchesIdentifier(firstToken)) {
Token secondToken = firstToken.next;
Token thirdToken = secondToken.next;
Token nextToken;
Identifier identifier;
- if (_tokenMatches(secondToken, TokenType.PERIOD) &&
- _tokenMatchesIdentifier(thirdToken)) {
- identifier = new PrefixedIdentifier(new SimpleIdentifier(firstToken),
- secondToken, new SimpleIdentifier(thirdToken));
- nextToken = thirdToken.next;
+ if (_tokenMatches(secondToken, TokenType.PERIOD)) {
+ if (thirdToken.isUserDefinableOperator) {
+ identifier = new PrefixedIdentifier(
+ new SimpleIdentifier(firstToken),
+ secondToken,
+ new SimpleIdentifier(thirdToken));
+ nextToken = thirdToken.next;
+ } else if (_tokenMatchesKeyword(thirdToken, Keyword.OPERATOR)) {
+ Token fourthToken = thirdToken.next;
+ if (fourthToken.isUserDefinableOperator) {
+ identifier = new PrefixedIdentifier(
+ new SimpleIdentifier(firstToken),
+ secondToken,
+ new SimpleIdentifier(fourthToken));
+ nextToken = fourthToken.next;
+ } else {
+ return null;
+ }
+ } else if (_tokenMatchesIdentifier(thirdToken)) {
+ identifier = new PrefixedIdentifier(
+ new SimpleIdentifier(firstToken),
+ secondToken,
+ new SimpleIdentifier(thirdToken));
+ nextToken = thirdToken.next;
+ }
} else {
identifier = new SimpleIdentifier(firstToken);
nextToken = firstToken.next;

Powered by Google App Engine
This is Rietveld 408576698