mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 16:21:04 +01:00
Change ParameterList to use a Start that brackets params (#2403)
The code change is small here. I'm breaking this out because it has a lot of test churn, and semantics doesn't have significant logic around it yet.
This commit is contained in:
@@ -987,11 +987,8 @@ auto Parser::HandleFunctionIntroducerState() -> void {
|
||||
// function parsing.
|
||||
state.state = ParserState::FunctionAfterParameterList();
|
||||
PushState(state);
|
||||
// TODO: When swapping () start/end, this should AddLeafNode the open before
|
||||
// continuing.
|
||||
PushState(ParserState::FunctionParameterListFinish());
|
||||
// Advance past the open paren.
|
||||
++position_;
|
||||
AddLeafNode(ParseNodeKind::ParameterListStart(), Consume());
|
||||
if (!PositionIs(TokenKind::CloseParen())) {
|
||||
PushState(ParserState::FunctionParameter());
|
||||
}
|
||||
@@ -1021,10 +1018,8 @@ auto Parser::HandleFunctionParameterFinishState() -> void {
|
||||
auto Parser::HandleFunctionParameterListFinishState() -> void {
|
||||
auto state = PopState();
|
||||
|
||||
CARBON_CHECK(ConsumeAndAddLeafNodeIf(TokenKind::CloseParen(),
|
||||
ParseNodeKind::ParameterListEnd()))
|
||||
<< PositionKind().Name();
|
||||
AddNode(ParseNodeKind::ParameterList(), state.token, state.subtree_start,
|
||||
CARBON_CHECK(PositionIs(TokenKind::CloseParen())) << PositionKind().Name();
|
||||
AddNode(ParseNodeKind::ParameterList(), Consume(), state.subtree_start,
|
||||
state.has_error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user