Handle malformed subscript expressions (#3064)

Closes #3063

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Geoff Romer
2023-08-07 23:14:20 +00:00
committed by GitHub
co-authored by Richard Smith
parent 7feaed312a
commit 049fbc1ee4
7 changed files with 56 additions and 23 deletions
@@ -19,9 +19,9 @@ auto ParserHandleIndexExpression(ParserContext& context) -> void {
auto ParserHandleIndexExpressionFinish(ParserContext& context) -> void {
auto state = context.PopState();
context.AddNode(ParseNodeKind::IndexExpression,
context.ConsumeChecked(TokenKind::CloseSquareBracket),
state.subtree_start, state.has_error);
context.ConsumeAndAddCloseSymbol(state.token, state,
ParseNodeKind::IndexExpression);
}
} // namespace Carbon