Files
carbon-lang/toolchain/parse/handle_pattern.cpp
T
Geoff Romer 943acf1ec2 Separate node kind for bindings inside var (#4822)
This is a step toward making binding pattern handling more robust, by
removing its reliance on the node stack for context.
2025-01-21 20:15:19 +00:00

21 lines
677 B
C++

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "toolchain/parse/context.h"
#include "toolchain/parse/handle.h"
namespace Carbon::Parse {
auto HandlePattern(Context& context) -> void {
auto state = context.PopState();
if (context.PositionKind() == Lex::TokenKind::OpenParen) {
context.PushStateForPattern(State::PatternListAsTuple,
state.in_var_pattern);
} else {
context.PushStateForPattern(State::BindingPattern, state.in_var_pattern);
}
}
} // namespace Carbon::Parse