Skip to content

Commit 1934efb

Browse files
srawlinsCommit Queue
authored and
Commit Queue
committed
Refactor comment reference parsing, away from stack.
Now that comment reference parsing is done entirely in ast_builder, we can simplify the implementation. Work towards #50702 Change-Id: I0650706dfe31542454c7bc9832ec6104c141bd5d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316643 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Paul Berry <[email protected]>
1 parent c9d6986 commit 1934efb

File tree

6 files changed

+118
-302
lines changed

6 files changed

+118
-302
lines changed

pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart

-22
Original file line numberDiff line numberDiff line change
@@ -1407,23 +1407,6 @@ class ForwardingListener implements Listener {
14071407
listener?.handleMixinWithClause(withKeyword);
14081408
}
14091409

1410-
@override
1411-
void handleCommentReference(
1412-
Token? newKeyword,
1413-
Token? firstToken,
1414-
Token? firstPeriod,
1415-
Token? secondToken,
1416-
Token? secondPeriod,
1417-
Token thirdToken) {
1418-
listener?.handleCommentReference(newKeyword, firstToken, firstPeriod,
1419-
secondToken, secondPeriod, thirdToken);
1420-
}
1421-
1422-
@override
1423-
void handleCommentReferenceText(String referenceSource, int referenceOffset) {
1424-
listener?.handleCommentReferenceText(referenceSource, referenceOffset);
1425-
}
1426-
14271410
@override
14281411
void handleConditionalExpressionColon() {
14291412
listener?.handleConditionalExpressionColon();
@@ -1752,11 +1735,6 @@ class ForwardingListener implements Listener {
17521735
listener?.handleNoArguments(token);
17531736
}
17541737

1755-
@override
1756-
void handleNoCommentReference() {
1757-
listener?.handleNoCommentReference();
1758-
}
1759-
17601738
@override
17611739
void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
17621740
listener?.handleNoConstructorReferenceContinuationAfterTypeArguments(token);

pkg/_fe_analyzer_shared/lib/src/parser/listener.dart

-33
Original file line numberDiff line numberDiff line change
@@ -2287,39 +2287,6 @@ class Listener implements UnescapeErrorListener {
22872287
logEvent("Script");
22882288
}
22892289

2290-
/// A single comment reference has been found
2291-
/// where [referenceSource] is the text between the `[` and `]`
2292-
/// and [referenceOffset] is the character offset in the token stream.
2293-
///
2294-
/// This event is generated by the parser when the parser's
2295-
/// `parseCommentReferences` method is called. For further processing,
2296-
/// a listener may scan the [referenceSource] and then pass the resulting
2297-
/// token stream to the parser's `parseOneCommentReference` method.
2298-
void handleCommentReferenceText(String referenceSource, int referenceOffset) {
2299-
logEvent("CommentReferenceText");
2300-
}
2301-
2302-
/// A single comment reference has been parsed.
2303-
/// * [newKeyword] may be null.
2304-
/// * [firstToken] and [firstPeriod] are either both tokens or both
2305-
/// `null`.
2306-
/// * [secondToken] and [secondPeriod] are either both tokens or both `null`.
2307-
/// * [thirdToken] can be an identifier or an operator.
2308-
///
2309-
/// This event is generated by the parser when the parser's
2310-
/// `parseOneCommentReference` method is called.
2311-
void handleCommentReference(
2312-
Token? newKeyword,
2313-
Token? firstToken,
2314-
Token? firstPeriod,
2315-
Token? secondToken,
2316-
Token? secondPeriod,
2317-
Token thirdToken) {}
2318-
2319-
/// This event is generated by the parser when the parser's
2320-
/// `parseOneCommentReference` method is called.
2321-
void handleNoCommentReference() {}
2322-
23232290
/// An expression was encountered consisting of type arguments applied to a
23242291
/// subexpression. This could validly represent any of the following:
23252292
/// - A type literal (`var x = List<int>;`)

0 commit comments

Comments
 (0)