mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 15:41:04 +01:00
Switch the driver to print ParseTree postorder by default (#2371)
The ParseTree comments say that preorder is "easier to visualize and read". The problem is, both the ParseTree and Semantics need to operate on the postorder traversal: the ParseTree during construction, and the Semantics during processing. As a consequence, understanding the postorder traversal is important, but it's also very hard to decipher when presented preorder. This PR provides a way to see the postorder, with helpful indents to show subtrees. This retains the preorder printing as an option for people who prefer that. I'm pretty sure it'll be easier to debug tests if we can see the postorder, so I'm making that the default. Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
This commit is contained in:
co-authored by
Chandler Carruth
parent
7c102d3726
commit
e21449edff
@@ -5,12 +5,12 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn F();
|
||||
|
||||
+4
-4
@@ -5,10 +5,10 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 3, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'foo'}]},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_identifier_instead_of_sig.carbon:[[@LINE+1]]:8: Expected `(` after function name.
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_missing_name.carbon:[[@LINE+1]]:4: Expected function name after `fn` keyword.
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 3, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'foo'}]},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_no_sig_or_semi.carbon:[[@LINE+1]]:7: Expected `(` after function name.
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_only_fn_and_semi.carbon:[[@LINE+1]]:3: Expected function name after `fn` keyword.
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_repeated_fn_and_semi.carbon:[[@LINE+1]]:4: Expected function name after `fn` keyword.
|
||||
|
||||
Vendored
+8
-8
@@ -5,14 +5,14 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 6, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 7, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon:[[@LINE+1]]:6: Expected function name after `fn` keyword.
|
||||
|
||||
+8
-8
@@ -5,14 +5,14 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 6, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 7, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon:[[@LINE+1]]:4: Expected function name after `fn` keyword.
|
||||
|
||||
Vendored
+8
-8
@@ -5,14 +5,14 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 6, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 7, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon:[[@LINE+1]]:4: Expected function name after `fn` keyword.
|
||||
|
||||
+8
-8
@@ -5,14 +5,14 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 6, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 7, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: 'fn', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon:[[@LINE+1]]:4: Expected function name after `fn` keyword.
|
||||
|
||||
+6
-6
@@ -5,12 +5,12 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'F'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon:[[@LINE+1]]:1: Unrecognized declaration introducer.
|
||||
|
||||
+6
-6
@@ -5,12 +5,12 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'FunctionDeclaration', text: ';', subtree_size: 5, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'ParameterList', text: '(', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 5},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_with_identifier_as_param.carbon:[[@LINE+1]]:8: Expected parameter declaration.
|
||||
|
||||
Vendored
+3
-3
@@ -5,9 +5,9 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{not} %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'}]},
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', has_error: yes, subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
// CHECK:STDERR: {{.*}}/toolchain/parser/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+1]]:4: Expected function name after `fn` keyword.
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 11, kind: 'FunctionDeclaration', text: ';', subtree_size: 12, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {node_index: 10, kind: 'ParameterList', text: '(', subtree_size: 9, children: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'PatternBinding', text: ':', subtree_size: 3, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'DeclaredName', text: 'bar'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'Literal', text: 'i32'}]},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'ParameterListComma', text: ','},
|
||||
// CHECK:STDOUT: {node_index: 8, kind: 'PatternBinding', text: ':', subtree_size: 3, children: [
|
||||
// CHECK:STDOUT: {node_index: 6, kind: 'DeclaredName', text: 'baz'},
|
||||
// CHECK:STDOUT: {node_index: 7, kind: 'Literal', text: 'i32'}]},
|
||||
// CHECK:STDOUT: {node_index: 9, kind: 'ParameterListEnd', text: ')'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 12, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'bar'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListComma', text: ','},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'baz'},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'i32'},
|
||||
// CHECK:STDOUT: {kind: 'PatternBinding', text: ':', subtree_size: 3},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 9},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 12},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn foo(bar: i32, baz: i32);
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
// AUTOUPDATE
|
||||
// RUN: %{carbon-run-parser}
|
||||
// CHECK:STDOUT: [
|
||||
// CHECK:STDOUT: {node_index: 6, kind: 'FunctionDeclaration', text: ';', subtree_size: 7, children: [
|
||||
// CHECK:STDOUT: {node_index: 0, kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {node_index: 1, kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {node_index: 3, kind: 'ParameterList', text: '(', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 2, kind: 'ParameterListEnd', text: ')'}]},
|
||||
// CHECK:STDOUT: {node_index: 5, kind: 'ReturnType', text: '->', subtree_size: 2, children: [
|
||||
// CHECK:STDOUT: {node_index: 4, kind: 'Literal', text: 'u32'}]}]},
|
||||
// CHECK:STDOUT: {node_index: 7, kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: {kind: 'FunctionIntroducer', text: 'fn'},
|
||||
// CHECK:STDOUT: {kind: 'DeclaredName', text: 'foo'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterListEnd', text: ')'},
|
||||
// CHECK:STDOUT: {kind: 'ParameterList', text: '(', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'Literal', text: 'u32'},
|
||||
// CHECK:STDOUT: {kind: 'ReturnType', text: '->', subtree_size: 2},
|
||||
// CHECK:STDOUT: {kind: 'FunctionDeclaration', text: ';', subtree_size: 7},
|
||||
// CHECK:STDOUT: {kind: 'FileEnd', text: ''},
|
||||
// CHECK:STDOUT: ]
|
||||
|
||||
fn foo() -> u32;
|
||||
|
||||
Reference in New Issue
Block a user