mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
This is a step toward making binding pattern handling more robust, by removing its reliance on the node stack for context.
21 lines
677 B
C++
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
|