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.
This commit is contained in:
Jon Ross-Perkins
2023-07-14 23:16:16 +00:00
committed by GitHub
parent 6a2b9684fb
commit 43065a1257
13 changed files with 122 additions and 112 deletions
@@ -111,7 +111,7 @@ auto SemanticsHandleReturnType(SemanticsContext& context,
ParseTree::Node parse_node) -> bool {
// Propagate the type expression.
auto [type_parse_node, type_node_id] =
context.node_stack().PopWithParseNode<SemanticsNodeId>();
context.node_stack().PopExpressionWithParseNode();
auto cast_node_id = context.ExpressionAsType(type_parse_node, type_node_id);
context.node_stack().Push(parse_node, cast_node_id);
return true;