Files
carbon-lang/toolchain/semantics/semantics_handle_paren.cpp
T
Jon Ross-Perkins 43065a1257 Finish refactoring Push/Pop for stronger type handling. (#2987)
This adds a distinction between Unused and SoloParseNode, rather than
equating the two. This is intended to help identify nodes which are
getting pushed but maybe don't need to be.

Not totally done because I want to adjust declaration name handling due
to a quirk with how it mixes Name with Expression, but almost done. Once
that's done the type punning will be completely gone.
2023-07-14 23:16:16 +00:00

36 lines
1.2 KiB
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/semantics/semantics_context.h"
namespace Carbon {
auto SemanticsHandleParenExpression(SemanticsContext& context,
ParseTree::Node parse_node) -> bool {
auto value_id = context.node_stack().PopExpression();
context.node_stack()
.PopAndDiscardSoloParseNode<
ParseNodeKind::ParenExpressionOrTupleLiteralStart>();
context.node_stack().Push(parse_node, value_id);
return true;
}
auto SemanticsHandleParenExpressionOrTupleLiteralStart(
SemanticsContext& context, ParseTree::Node parse_node) -> bool {
context.node_stack().Push(parse_node);
return true;
}
auto SemanticsHandleTupleLiteral(SemanticsContext& context,
ParseTree::Node parse_node) -> bool {
return context.TODO(parse_node, "HandleTupleLiteral");
}
auto SemanticsHandleTupleLiteralComma(SemanticsContext& context,
ParseTree::Node parse_node) -> bool {
return context.TODO(parse_node, "HandleTupleLiteralComma");
}
} // namespace Carbon