mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 22:02:51 +01:00
Support tuple patterns outside parameter lists (#4923)
Parameter lists need substantially different treatment than tuple patterns in other contexts, so this change splits them into separate parse node kinds. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
35f5a7f115
commit
74e1a9949f
@@ -98,10 +98,10 @@ TEST_F(TreeTest, PrintPostorderAsYAML) {
|
||||
ElementsAre(Pair("kind", "FunctionIntroducer"), Pair("text", "fn"))),
|
||||
Yaml::Mapping(ElementsAre(Pair("kind", "IdentifierNameBeforeParams"),
|
||||
Pair("text", "F"))),
|
||||
Yaml::Mapping(
|
||||
ElementsAre(Pair("kind", "TuplePatternStart"), Pair("text", "("))),
|
||||
Yaml::Mapping(ElementsAre(Pair("kind", "TuplePattern"), Pair("text", ")"),
|
||||
Pair("subtree_size", "2"))),
|
||||
Yaml::Mapping(ElementsAre(Pair("kind", "ExplicitParamListStart"),
|
||||
Pair("text", "("))),
|
||||
Yaml::Mapping(ElementsAre(Pair("kind", "ExplicitParamList"),
|
||||
Pair("text", ")"), Pair("subtree_size", "2"))),
|
||||
Yaml::Mapping(ElementsAre(Pair("kind", "FunctionDecl"), Pair("text", ";"),
|
||||
Pair("subtree_size", "5"))),
|
||||
Yaml::Mapping(ElementsAre(Pair("kind", "FileEnd"), Pair("text", "")))));
|
||||
@@ -122,8 +122,8 @@ TEST_F(TreeTest, PrintPreorderAsYAML) {
|
||||
tree_and_subtrees.PrintPreorder(print_stream);
|
||||
|
||||
auto param_list = Yaml::Sequence(ElementsAre(Yaml::Mapping(
|
||||
ElementsAre(Pair("node_index", "3"), Pair("kind", "TuplePatternStart"),
|
||||
Pair("text", "(")))));
|
||||
ElementsAre(Pair("node_index", "3"),
|
||||
Pair("kind", "ExplicitParamListStart"), Pair("text", "(")))));
|
||||
|
||||
auto function_decl = Yaml::Sequence(ElementsAre(
|
||||
Yaml::Mapping(ElementsAre(Pair("node_index", "1"),
|
||||
@@ -133,8 +133,8 @@ TEST_F(TreeTest, PrintPreorderAsYAML) {
|
||||
Pair("kind", "IdentifierNameBeforeParams"),
|
||||
Pair("text", "F"))),
|
||||
Yaml::Mapping(ElementsAre(Pair("node_index", "4"),
|
||||
Pair("kind", "TuplePattern"), Pair("text", ")"),
|
||||
Pair("subtree_size", "2"),
|
||||
Pair("kind", "ExplicitParamList"),
|
||||
Pair("text", ")"), Pair("subtree_size", "2"),
|
||||
Pair("children", param_list)))));
|
||||
|
||||
auto file = Yaml::Sequence(ElementsAre(
|
||||
|
||||
Reference in New Issue
Block a user