mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Change return of SkipPastLikelyEnd to be last consumed token (#3493)
This approach means the parse subtree includes the full token range consumed. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
1addf10054
commit
6067ca3f49
@@ -401,14 +401,9 @@ auto HandleExprStatementFinish(Context& context) -> void {
|
||||
context.emitter().Emit(*context.position(), ExpectedExprSemi);
|
||||
}
|
||||
|
||||
if (auto semi_token = context.SkipPastLikelyEnd(state.token)) {
|
||||
context.AddNode(NodeKind::ExprStatement, *semi_token, state.subtree_start,
|
||||
/*has_error=*/true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Found junk not even followed by a `;`, no node to add.
|
||||
context.ReturnErrorOnState();
|
||||
context.AddNode(NodeKind::ExprStatement,
|
||||
context.SkipPastLikelyEnd(state.token), state.subtree_start,
|
||||
/*has_error=*/true);
|
||||
}
|
||||
|
||||
} // namespace Carbon::Parse
|
||||
|
||||
Reference in New Issue
Block a user