Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 110a29c

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Issue 40704. Support for ?[ in resolution.
Bug: dart-lang/sdk#40704 Change-Id: Iaa4680e65a44c83bdc6a3ae826cc510b685a7ccf Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138563 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 55b4a24 commit 110a29c

File tree

4 files changed

+230
-53
lines changed

4 files changed

+230
-53
lines changed

pkg/analyzer/lib/src/dart/ast/ast.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5853,6 +5853,7 @@ class IndexExpressionImpl extends ExpressionImpl
58535853

58545854
@override
58555855
bool get isNullAware =>
5856+
question != null ||
58565857
leftBracket.type == TokenType.QUESTION_PERIOD_OPEN_SQUARE_BRACKET ||
58575858
(leftBracket.type == TokenType.OPEN_SQUARE_BRACKET &&
58585859
period != null &&

pkg/analyzer/lib/src/dart/ast/to_source_visitor.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,13 +741,14 @@ class ToSourceVisitor implements AstVisitor<void> {
741741
@override
742742
void visitIndexExpression(IndexExpression node) {
743743
if (node.isCascaded) {
744-
sink.write(node.period.lexeme);
744+
safelyVisitToken(node.period);
745745
} else {
746746
safelyVisitNode(node.target);
747747
}
748-
sink.write('[');
748+
safelyVisitToken(node.question);
749+
safelyVisitToken(node.leftBracket);
749750
safelyVisitNode(node.index);
750-
sink.write(']');
751+
safelyVisitToken(node.rightBracket);
751752
}
752753

753754
@override

0 commit comments

Comments
 (0)