Add support for VariableDeclaration and VariableInitialization (#2466)

This starts dealing with assignment for the initializer, please let me know if you have thoughts there (including for naming).
This commit is contained in:
Jon Ross-Perkins
2022-12-14 13:42:53 -08:00
committed by GitHub
parent 8e29547911
commit 6c248ea38f
9 changed files with 227 additions and 49 deletions
@@ -71,6 +71,18 @@ class SemanticsParseTreeHandler {
// returning the result_id. Must only be called for nodes that have results.
auto PopWithResult(ParseNodeKind pop_parse_kind) -> SemanticsNodeId;
// Pops the top of the stack, verifying that it's the expected kind and
// returning the result_id. Must only be called for nodes that have results.
auto PopWithResultIf(ParseNodeKind pop_parse_kind)
-> std::optional<SemanticsNodeId>;
// Attempts a type conversion between arguments of the two arguments with
// provided types, returning the result type. The result type will be invalid
// for errors; this handles printing diagnostics.
auto TryTypeConversion(ParseTree::Node parse_node, SemanticsNodeId lhs_id,
SemanticsNodeId rhs_id, bool can_convert_lhs)
-> SemanticsNodeId;
// Parse node handlers.
#define CARBON_PARSE_NODE_KIND(Name) \
auto Handle##Name(ParseTree::Node parse_node)->void;