From 9b5b785aa4eafcca93f5c2bd15f722b0d4096446 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:20:41 +0100 Subject: [PATCH] Import code samples for Ruby 3.3 from the parser gem Slightly tweaking the import script becaues of backtrace format changes in Ruby 3.4 Most tests pass in all parsers, with only a handful of failures overall --- rakelib/whitequark.rake | 11 +- test/prism/fixtures/whitequark/LICENSE | 3 +- .../fixtures/whitequark/arg_combinations.txt | 29 + .../whitequark/block_arg_combinations.txt | 57 + .../prism/fixtures/whitequark/block_kwarg.txt | 1 + .../whitequark/block_kwarg_combinations.txt | 5 + .../emit_arg_inside_procarg0_legacy.txt | 1 + .../fixtures/whitequark/find_pattern.txt | 7 + .../whitequark/kwarg_combinations.txt | 7 + .../fixtures/whitequark/kwarg_no_paren.txt | 5 + .../whitequark/lvar_injecting_match.txt | 2 + .../fixtures/whitequark/marg_combinations.txt | 19 + .../multiple_args_with_trailing_comma.txt | 1 + .../pattern_matching_const_pattern.txt | 11 + .../whitequark/pattern_matching_constants.txt | 5 + .../pattern_matching_explicit_array_match.txt | 19 + .../pattern_matching_expr_in_paren.txt | 1 + .../whitequark/pattern_matching_hash.txt | 48 + .../pattern_matching_if_unless_modifiers.txt | 3 + .../pattern_matching_implicit_array_match.txt | 15 + .../pattern_matching_keyword_variable.txt | 1 + .../whitequark/pattern_matching_lambda.txt | 1 + .../whitequark/pattern_matching_match_alt.txt | 1 + .../whitequark/pattern_matching_match_as.txt | 1 + .../pattern_matching_nil_pattern.txt | 1 + .../whitequark/pattern_matching_no_body.txt | 1 + .../whitequark/pattern_matching_ranges.txt | 11 + .../pattern_matching_single_match.txt | 1 + test/prism/fixtures/whitequark/pin_expr.txt | 14 + .../fixtures/whitequark/procarg0_legacy.txt | 1 + .../fixtures/whitequark/ruby_bug_18878.txt | 1 + .../fixtures/whitequark/ruby_bug_19281.txt | 7 + .../fixtures/whitequark/ruby_bug_19539.txt | 9 + test/prism/fixtures_test.rb | 21 +- test/prism/lex_test.rb | 8 + test/prism/ruby/parser_test.rb | 4 + test/prism/ruby/ripper_test.rb | 1 + test/prism/ruby/ruby_parser_test.rb | 5 + .../snapshots/whitequark/arg_combinations.txt | 564 ++++++++ .../whitequark/block_arg_combinations.txt | 1151 +++++++++++++++++ .../snapshots/whitequark/block_kwarg.txt | 43 + .../whitequark/block_kwarg_combinations.txt | 152 +++ .../emit_arg_inside_procarg0_legacy.txt | 42 + .../snapshots/whitequark/find_pattern.txt | 218 ++++ .../whitequark/kwarg_combinations.txt | 158 +++ .../snapshots/whitequark/kwarg_no_paren.txt | 65 + .../whitequark/lvar_injecting_match.txt | 116 +- .../whitequark/marg_combinations.txt | 391 ++++++ .../multiple_args_with_trailing_comma.txt | 47 + .../pattern_matching_const_pattern.txt | 287 ++++ .../whitequark/pattern_matching_constants.txt | 109 ++ .../pattern_matching_explicit_array_match.txt | 471 +++++++ .../pattern_matching_expr_in_paren.txt | 43 + .../whitequark/pattern_matching_hash.txt | 833 ++++++++++++ .../pattern_matching_if_unless_modifiers.txt | 97 ++ .../pattern_matching_implicit_array_match.txt | 387 ++++++ .../pattern_matching_keyword_variable.txt | 37 + .../whitequark/pattern_matching_lambda.txt | 49 + .../whitequark/pattern_matching_match_alt.txt | 46 + .../whitequark/pattern_matching_match_as.txt | 47 + .../pattern_matching_nil_pattern.txt | 46 + .../whitequark/pattern_matching_no_body.txt | 33 + .../whitequark/pattern_matching_ranges.txt | 229 ++++ .../pattern_matching_single_match.txt | 41 + test/prism/snapshots/whitequark/pin_expr.txt | 274 ++++ .../snapshots/whitequark/procarg0_legacy.txt | 42 + .../snapshots/whitequark/ruby_bug_18878.txt | 51 + .../snapshots/whitequark/ruby_bug_19281.txt | 181 +++ .../snapshots/whitequark/ruby_bug_19539.txt | 19 + 69 files changed, 6580 insertions(+), 28 deletions(-) create mode 100644 test/prism/fixtures/whitequark/arg_combinations.txt create mode 100644 test/prism/fixtures/whitequark/block_arg_combinations.txt create mode 100644 test/prism/fixtures/whitequark/block_kwarg.txt create mode 100644 test/prism/fixtures/whitequark/block_kwarg_combinations.txt create mode 100644 test/prism/fixtures/whitequark/emit_arg_inside_procarg0_legacy.txt create mode 100644 test/prism/fixtures/whitequark/find_pattern.txt create mode 100644 test/prism/fixtures/whitequark/kwarg_combinations.txt create mode 100644 test/prism/fixtures/whitequark/kwarg_no_paren.txt create mode 100644 test/prism/fixtures/whitequark/marg_combinations.txt create mode 100644 test/prism/fixtures/whitequark/multiple_args_with_trailing_comma.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_const_pattern.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_constants.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_explicit_array_match.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_expr_in_paren.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_hash.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_if_unless_modifiers.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_implicit_array_match.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_keyword_variable.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_lambda.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_match_alt.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_match_as.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_nil_pattern.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_no_body.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_ranges.txt create mode 100644 test/prism/fixtures/whitequark/pattern_matching_single_match.txt create mode 100644 test/prism/fixtures/whitequark/pin_expr.txt create mode 100644 test/prism/fixtures/whitequark/procarg0_legacy.txt create mode 100644 test/prism/fixtures/whitequark/ruby_bug_18878.txt create mode 100644 test/prism/fixtures/whitequark/ruby_bug_19281.txt create mode 100644 test/prism/fixtures/whitequark/ruby_bug_19539.txt create mode 100644 test/prism/snapshots/whitequark/arg_combinations.txt create mode 100644 test/prism/snapshots/whitequark/block_arg_combinations.txt create mode 100644 test/prism/snapshots/whitequark/block_kwarg.txt create mode 100644 test/prism/snapshots/whitequark/block_kwarg_combinations.txt create mode 100644 test/prism/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt create mode 100644 test/prism/snapshots/whitequark/find_pattern.txt create mode 100644 test/prism/snapshots/whitequark/kwarg_combinations.txt create mode 100644 test/prism/snapshots/whitequark/kwarg_no_paren.txt create mode 100644 test/prism/snapshots/whitequark/marg_combinations.txt create mode 100644 test/prism/snapshots/whitequark/multiple_args_with_trailing_comma.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_const_pattern.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_constants.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_explicit_array_match.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_expr_in_paren.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_hash.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_implicit_array_match.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_keyword_variable.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_lambda.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_match_alt.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_match_as.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_nil_pattern.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_no_body.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_ranges.txt create mode 100644 test/prism/snapshots/whitequark/pattern_matching_single_match.txt create mode 100644 test/prism/snapshots/whitequark/pin_expr.txt create mode 100644 test/prism/snapshots/whitequark/procarg0_legacy.txt create mode 100644 test/prism/snapshots/whitequark/ruby_bug_18878.txt create mode 100644 test/prism/snapshots/whitequark/ruby_bug_19281.txt create mode 100644 test/prism/snapshots/whitequark/ruby_bug_19539.txt diff --git a/rakelib/whitequark.rake b/rakelib/whitequark.rake index 6eb2daef7ea..4d7fc94f9f9 100644 --- a/rakelib/whitequark.rake +++ b/rakelib/whitequark.rake @@ -38,7 +38,7 @@ namespace :whitequark do # This object is going to collect all of the examples from the parser gem # into a hash that we can use to generate our own tests. COLLECTED = Hash.new { |hash, key| hash[key] = [] } - ALL_VERSIONS = %w[3.1 3.2] + ALL_VERSIONS = %w[3.1 3.2 3.3] private @@ -60,10 +60,10 @@ namespace :whitequark do def assert_parses(_ast, code, _source_maps = "", versions = ALL_VERSIONS) # We're going to skip any examples that are for older Ruby versions # that we do not support. - return if (versions & %w[3.1 3.2]).empty? + return if (versions & ALL_VERSIONS).empty? - entry = caller.find { _1.include?("test_parser.rb") } - _, name = *entry.match(/\d+:in `(?:block in )?(?:test_|assert_parses_)?(.+)'/) + entry = caller_locations.find { _1.base_label.start_with?("test_") } + name = entry.base_label.delete_prefix("test_") COLLECTED[name] << code end @@ -94,7 +94,8 @@ namespace :whitequark do test/prism/fixtures/whitequark/if_while_after_class__since_32.txt test/prism/fixtures/whitequark/next_block.txt test/prism/fixtures/whitequark/next.txt - test/prism/fixtures/whitequark/pattern_match.txt + test/prism/fixtures/whitequark/pattern_matching_pin_variable.txt + test/prism/fixtures/whitequark/pattern_matching_hash_with_string_keys.txt test/prism/fixtures/whitequark/range_endless.txt test/prism/fixtures/whitequark/redo.txt test/prism/fixtures/whitequark/retry.txt diff --git a/test/prism/fixtures/whitequark/LICENSE b/test/prism/fixtures/whitequark/LICENSE index 971310e3d68..43f97889853 100644 --- a/test/prism/fixtures/whitequark/LICENSE +++ b/test/prism/fixtures/whitequark/LICENSE @@ -1,4 +1,5 @@ -Copyright (c) 2013-2016 whitequark +Copyright (c) 2013-2024 parser project contributors +Copyright (c) 2013-2016 Catherine Parts of the source are derived from ruby_parser: Copyright (c) Ryan Davis, seattle.rb diff --git a/test/prism/fixtures/whitequark/arg_combinations.txt b/test/prism/fixtures/whitequark/arg_combinations.txt new file mode 100644 index 00000000000..801b1e47f4c --- /dev/null +++ b/test/prism/fixtures/whitequark/arg_combinations.txt @@ -0,0 +1,29 @@ +def f &b; end + +def f *r, &b; end + +def f *r, p, &b; end + +def f ; end + +def f a, &b; end + +def f a, *r, &b; end + +def f a, *r, p, &b; end + +def f a, o=1, &b; end + +def f a, o=1, *r, &b; end + +def f a, o=1, *r, p, &b; end + +def f a, o=1, p, &b; end + +def f o=1, &b; end + +def f o=1, *r, &b; end + +def f o=1, *r, p, &b; end + +def f o=1, p, &b; end diff --git a/test/prism/fixtures/whitequark/block_arg_combinations.txt b/test/prism/fixtures/whitequark/block_arg_combinations.txt new file mode 100644 index 00000000000..ccb9cfea56c --- /dev/null +++ b/test/prism/fixtures/whitequark/block_arg_combinations.txt @@ -0,0 +1,57 @@ +f{ } + +f{ | | } + +f{ |&b| } + +f{ |*, &b| } + +f{ |*r, p, &b| } + +f{ |*s, &b| } + +f{ |*s| } + +f{ |*| } + +f{ |; +a +| } + +f{ |;a| } + +f{ |a, &b| } + +f{ |a, *, &b| } + +f{ |a, *r, p, &b| } + +f{ |a, *s, &b| } + +f{ |a, *s| } + +f{ |a, *| } + +f{ |a, c| } + +f{ |a, o=1, &b| } + +f{ |a, o=1, *r, p, &b| } + +f{ |a, o=1, o1=2, *r, &b| } + +f{ |a, o=1, p, &b| } + +f{ |a,| } + +f{ |a| } + +f{ |o=1, &b| } + +f{ |o=1, *r, &b| } + +f{ |o=1, *r, p, &b| } + +f{ |o=1, p, &b| } + +f{ || } diff --git a/test/prism/fixtures/whitequark/block_kwarg.txt b/test/prism/fixtures/whitequark/block_kwarg.txt new file mode 100644 index 00000000000..9f1283371f4 --- /dev/null +++ b/test/prism/fixtures/whitequark/block_kwarg.txt @@ -0,0 +1 @@ +f{ |foo:| } diff --git a/test/prism/fixtures/whitequark/block_kwarg_combinations.txt b/test/prism/fixtures/whitequark/block_kwarg_combinations.txt new file mode 100644 index 00000000000..3dbb961777a --- /dev/null +++ b/test/prism/fixtures/whitequark/block_kwarg_combinations.txt @@ -0,0 +1,5 @@ +f{ |**baz, &b| } + +f{ |foo: 1, &b| } + +f{ |foo: 1, bar: 2, **baz, &b| } diff --git a/test/prism/fixtures/whitequark/emit_arg_inside_procarg0_legacy.txt b/test/prism/fixtures/whitequark/emit_arg_inside_procarg0_legacy.txt new file mode 100644 index 00000000000..a985f15b6e0 --- /dev/null +++ b/test/prism/fixtures/whitequark/emit_arg_inside_procarg0_legacy.txt @@ -0,0 +1 @@ +f{ |a| } diff --git a/test/prism/fixtures/whitequark/find_pattern.txt b/test/prism/fixtures/whitequark/find_pattern.txt new file mode 100644 index 00000000000..fb8999ae288 --- /dev/null +++ b/test/prism/fixtures/whitequark/find_pattern.txt @@ -0,0 +1,7 @@ +case foo; in *, 42, * then true; end + +case foo; in Array[*, 1, *] then true; end + +case foo; in String(*, 1, *) then true; end + +case foo; in [*x, 1 => a, *y] then true; end diff --git a/test/prism/fixtures/whitequark/kwarg_combinations.txt b/test/prism/fixtures/whitequark/kwarg_combinations.txt new file mode 100644 index 00000000000..1bd792856e2 --- /dev/null +++ b/test/prism/fixtures/whitequark/kwarg_combinations.txt @@ -0,0 +1,7 @@ +def f (foo: 1, &b); end + +def f (foo: 1, bar: 2, **baz, &b); end + +def f **baz, &b; end + +def f *, **; end diff --git a/test/prism/fixtures/whitequark/kwarg_no_paren.txt b/test/prism/fixtures/whitequark/kwarg_no_paren.txt new file mode 100644 index 00000000000..cf29c273d0d --- /dev/null +++ b/test/prism/fixtures/whitequark/kwarg_no_paren.txt @@ -0,0 +1,5 @@ +def f foo: +; end + +def f foo: -1 +; end diff --git a/test/prism/fixtures/whitequark/lvar_injecting_match.txt b/test/prism/fixtures/whitequark/lvar_injecting_match.txt index ba814a1088a..2d18c84b571 100644 --- a/test/prism/fixtures/whitequark/lvar_injecting_match.txt +++ b/test/prism/fixtures/whitequark/lvar_injecting_match.txt @@ -1 +1,3 @@ +/(?a)/ =~ 'a'; /#{}(?b)/ =~ 'b'; a; b + /(?bar)/ =~ 'bar'; match diff --git a/test/prism/fixtures/whitequark/marg_combinations.txt b/test/prism/fixtures/whitequark/marg_combinations.txt new file mode 100644 index 00000000000..aff34dcb620 --- /dev/null +++ b/test/prism/fixtures/whitequark/marg_combinations.txt @@ -0,0 +1,19 @@ +def f (((a))); end + +def f ((*)); end + +def f ((*, p)); end + +def f ((*r)); end + +def f ((*r, p)); end + +def f ((a, *)); end + +def f ((a, *, p)); end + +def f ((a, *r)); end + +def f ((a, *r, p)); end + +def f ((a, a1)); end diff --git a/test/prism/fixtures/whitequark/multiple_args_with_trailing_comma.txt b/test/prism/fixtures/whitequark/multiple_args_with_trailing_comma.txt new file mode 100644 index 00000000000..b6907387578 --- /dev/null +++ b/test/prism/fixtures/whitequark/multiple_args_with_trailing_comma.txt @@ -0,0 +1 @@ +f{ |a, b,| } diff --git a/test/prism/fixtures/whitequark/pattern_matching_const_pattern.txt b/test/prism/fixtures/whitequark/pattern_matching_const_pattern.txt new file mode 100644 index 00000000000..82821dbc83c --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_const_pattern.txt @@ -0,0 +1,11 @@ +case foo; in A() then true; end + +case foo; in A(1, 2) then true; end + +case foo; in A(x:) then true; end + +case foo; in A[1, 2] then true; end + +case foo; in A[] then true; end + +case foo; in A[x:] then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_constants.txt b/test/prism/fixtures/whitequark/pattern_matching_constants.txt new file mode 100644 index 00000000000..aba764ff356 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_constants.txt @@ -0,0 +1,5 @@ +case foo; in ::A then true; end + +case foo; in A then true; end + +case foo; in A::B then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_explicit_array_match.txt b/test/prism/fixtures/whitequark/pattern_matching_explicit_array_match.txt new file mode 100644 index 00000000000..61e518d0fba --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_explicit_array_match.txt @@ -0,0 +1,19 @@ +case foo; in [*, x] then true; end + +case foo; in [*x, y] then true; end + +case foo; in [x, *, y] then true; end + +case foo; in [x, *y, z] then true; end + +case foo; in [x, y, *] then true; end + +case foo; in [x, y, *z] then true; end + +case foo; in [x, y,] then true; end + +case foo; in [x, y] then true; end + +case foo; in [x,] then nil; end + +case foo; in [x] then nil; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_expr_in_paren.txt b/test/prism/fixtures/whitequark/pattern_matching_expr_in_paren.txt new file mode 100644 index 00000000000..9b2e91b70dc --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_expr_in_paren.txt @@ -0,0 +1 @@ +case foo; in (1) then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_hash.txt b/test/prism/fixtures/whitequark/pattern_matching_hash.txt new file mode 100644 index 00000000000..b26f2c59dca --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_hash.txt @@ -0,0 +1,48 @@ +case foo; + in a: {b:}, c: + p c + ; end + +case foo; + in {Foo: 42 + } + false + ; end + +case foo; + in {a: + 2} + false + ; end + +case foo; + in {a: + } + true + ; end + +case foo; + in {a: 1 + } + false + ; end + +case foo; in ** then true; end + +case foo; in **a then true; end + +case foo; in a: 1 then true; end + +case foo; in a: 1, _a:, ** then true; end + +case foo; in a: 1, b: 2 then true; end + +case foo; in a: then true; end + +case foo; in a:, b: then true; end + +case foo; in { a: 1 } then true; end + +case foo; in { a: 1, } then true; end + +case foo; in {} then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_if_unless_modifiers.txt b/test/prism/fixtures/whitequark/pattern_matching_if_unless_modifiers.txt new file mode 100644 index 00000000000..05ca3173554 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_if_unless_modifiers.txt @@ -0,0 +1,3 @@ +case foo; in x if true; nil; end + +case foo; in x unless true; nil; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_implicit_array_match.txt b/test/prism/fixtures/whitequark/pattern_matching_implicit_array_match.txt new file mode 100644 index 00000000000..360c5150a51 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_implicit_array_match.txt @@ -0,0 +1,15 @@ +case foo; in * then nil; end + +case foo; in *x then nil; end + +case foo; in *x, y, z then nil; end + +case foo; in 1, "a", [], {} then nil; end + +case foo; in x, *y, z then nil; end + +case foo; in x, then nil; end + +case foo; in x, y then nil; end + +case foo; in x, y, then nil; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_keyword_variable.txt b/test/prism/fixtures/whitequark/pattern_matching_keyword_variable.txt new file mode 100644 index 00000000000..83c7a06b09e --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_keyword_variable.txt @@ -0,0 +1 @@ +case foo; in self then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_lambda.txt b/test/prism/fixtures/whitequark/pattern_matching_lambda.txt new file mode 100644 index 00000000000..eeccdc70e0c --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_lambda.txt @@ -0,0 +1 @@ +case foo; in ->{ 42 } then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_match_alt.txt b/test/prism/fixtures/whitequark/pattern_matching_match_alt.txt new file mode 100644 index 00000000000..6c6549916d3 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_match_alt.txt @@ -0,0 +1 @@ +case foo; in 1 | 2 then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_match_as.txt b/test/prism/fixtures/whitequark/pattern_matching_match_as.txt new file mode 100644 index 00000000000..2a105f9f367 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_match_as.txt @@ -0,0 +1 @@ +case foo; in 1 => a then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_nil_pattern.txt b/test/prism/fixtures/whitequark/pattern_matching_nil_pattern.txt new file mode 100644 index 00000000000..46dce94a2dc --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_nil_pattern.txt @@ -0,0 +1 @@ +case foo; in **nil then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_no_body.txt b/test/prism/fixtures/whitequark/pattern_matching_no_body.txt new file mode 100644 index 00000000000..73b471d3521 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_no_body.txt @@ -0,0 +1 @@ +case foo; in 1; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_ranges.txt b/test/prism/fixtures/whitequark/pattern_matching_ranges.txt new file mode 100644 index 00000000000..7e603e77b05 --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_ranges.txt @@ -0,0 +1,11 @@ +case foo; in ...2 then true; end + +case foo; in ..2 then true; end + +case foo; in 1.. then true; end + +case foo; in 1... then true; end + +case foo; in 1...2 then true; end + +case foo; in 1..2 then true; end diff --git a/test/prism/fixtures/whitequark/pattern_matching_single_match.txt b/test/prism/fixtures/whitequark/pattern_matching_single_match.txt new file mode 100644 index 00000000000..c174376585d --- /dev/null +++ b/test/prism/fixtures/whitequark/pattern_matching_single_match.txt @@ -0,0 +1 @@ +case foo; in x then x; end diff --git a/test/prism/fixtures/whitequark/pin_expr.txt b/test/prism/fixtures/whitequark/pin_expr.txt new file mode 100644 index 00000000000..a072c7c1947 --- /dev/null +++ b/test/prism/fixtures/whitequark/pin_expr.txt @@ -0,0 +1,14 @@ +case foo; in ^$TestPatternMatching; end + +case foo; in ^(0+0) then nil; end + +case foo; in ^(1 +); end + +case foo; in ^(42) then nil; end + +case foo; in ^@@TestPatternMatching; end + +case foo; in ^@a; end + +case foo; in { foo: ^(42) } then nil; end diff --git a/test/prism/fixtures/whitequark/procarg0_legacy.txt b/test/prism/fixtures/whitequark/procarg0_legacy.txt new file mode 100644 index 00000000000..a985f15b6e0 --- /dev/null +++ b/test/prism/fixtures/whitequark/procarg0_legacy.txt @@ -0,0 +1 @@ +f{ |a| } diff --git a/test/prism/fixtures/whitequark/ruby_bug_18878.txt b/test/prism/fixtures/whitequark/ruby_bug_18878.txt new file mode 100644 index 00000000000..583280c9e33 --- /dev/null +++ b/test/prism/fixtures/whitequark/ruby_bug_18878.txt @@ -0,0 +1 @@ +Foo::Bar { |a| 42 } diff --git a/test/prism/fixtures/whitequark/ruby_bug_19281.txt b/test/prism/fixtures/whitequark/ruby_bug_19281.txt new file mode 100644 index 00000000000..cd154f97569 --- /dev/null +++ b/test/prism/fixtures/whitequark/ruby_bug_19281.txt @@ -0,0 +1,7 @@ +a.b (1;2),(3),(4) + +a.b (;),(),() + +p (1;2),(3),(4) + +p (;),(),() diff --git a/test/prism/fixtures/whitequark/ruby_bug_19539.txt b/test/prism/fixtures/whitequark/ruby_bug_19539.txt new file mode 100644 index 00000000000..b2d052d94da --- /dev/null +++ b/test/prism/fixtures/whitequark/ruby_bug_19539.txt @@ -0,0 +1,9 @@ +<<' FOO' +[Bug #19539] + FOO + + +<<-' FOO' +[Bug #19539] + FOO + diff --git a/test/prism/fixtures_test.rb b/test/prism/fixtures_test.rb index 7225b4ac66c..3b4a502b901 100644 --- a/test/prism/fixtures_test.rb +++ b/test/prism/fixtures_test.rb @@ -8,11 +8,22 @@ module Prism class FixturesTest < TestCase except = [] - # Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace - # characters in the heredoc start. - # Example: <<~' EOF' or <<-' EOF' - # https://bugs.ruby-lang.org/issues/19539 - except << "heredocs_leading_whitespace.txt" if RUBY_VERSION < "3.3.0" + + if RUBY_VERSION < "3.3.0" + # Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace + # characters in the heredoc start. + # Example: <<~' EOF' or <<-' EOF' + # https://bugs.ruby-lang.org/issues/19539 + except << "heredocs_leading_whitespace.txt" + except << "whitequark/ruby_bug_19539.txt" + + # https://bugs.ruby-lang.org/issues/19025 + except << "whitequark/numparam_ruby_bug_19025.txt" + # https://bugs.ruby-lang.org/issues/18878 + except << "whitequark/ruby_bug_18878.txt" + # https://bugs.ruby-lang.org/issues/19281 + except << "whitequark/ruby_bug_19281.txt" + end Fixture.each(except: except) do |fixture| define_method(fixture.test_name) { assert_valid_syntax(fixture.read) } diff --git a/test/prism/lex_test.rb b/test/prism/lex_test.rb index 7eac677ef70..0e03874a158 100644 --- a/test/prism/lex_test.rb +++ b/test/prism/lex_test.rb @@ -28,6 +28,14 @@ class LexTest < TestCase # Example: <<~' EOF' or <<-' EOF' # https://bugs.ruby-lang.org/issues/19539 except << "heredocs_leading_whitespace.txt" + except << "whitequark/ruby_bug_19539.txt" + + # https://bugs.ruby-lang.org/issues/19025 + except << "whitequark/numparam_ruby_bug_19025.txt" + # https://bugs.ruby-lang.org/issues/18878 + except << "whitequark/ruby_bug_18878.txt" + # https://bugs.ruby-lang.org/issues/19281 + except << "whitequark/ruby_bug_19281.txt" end Fixture.each(except: except) do |fixture| diff --git a/test/prism/ruby/parser_test.rb b/test/prism/ruby/parser_test.rb index 05658d1fa1c..0db74bd2ffb 100644 --- a/test/prism/ruby/parser_test.rb +++ b/test/prism/ruby/parser_test.rb @@ -121,10 +121,14 @@ class ParserTest < TestCase "whitequark/bug_ascii_8bit_in_literal.txt", "whitequark/bug_def_no_paren_eql_begin.txt", "whitequark/forward_arg_with_open_args.txt", + "whitequark/kwarg_no_paren.txt", "whitequark/lbrace_arg_after_command_args.txt", "whitequark/multiple_pattern_matches.txt", "whitequark/newline_in_hash_argument.txt", "whitequark/parser_bug_640.txt", + "whitequark/pattern_matching_expr_in_paren.txt", + "whitequark/pattern_matching_hash.txt", + "whitequark/pin_expr.txt", "whitequark/ruby_bug_14690.txt", "whitequark/ruby_bug_9669.txt", "whitequark/slash_newline_in_heredocs.txt", diff --git a/test/prism/ruby/ripper_test.rb b/test/prism/ruby/ripper_test.rb index 8db47da3d35..7ed32ed2164 100644 --- a/test/prism/ruby/ripper_test.rb +++ b/test/prism/ruby/ripper_test.rb @@ -45,6 +45,7 @@ class RipperTest < TestCase "whitequark/dedenting_heredoc.txt", "whitequark/parser_drops_truncated_parts_of_squiggly_heredoc.txt", "whitequark/parser_slash_slash_n_escaping_in_literals.txt", + "whitequark/ruby_bug_18878.txt", "whitequark/send_block_chain_cmd.txt", "whitequark/slash_newline_in_heredocs.txt" ] diff --git a/test/prism/ruby/ruby_parser_test.rb b/test/prism/ruby/ruby_parser_test.rb index fe410c8144d..1aa0f540cc5 100644 --- a/test/prism/ruby/ruby_parser_test.rb +++ b/test/prism/ruby/ruby_parser_test.rb @@ -38,6 +38,9 @@ class RubyParserTest < TestCase "unparser/corpus/literal/kwbegin.txt", "unparser/corpus/literal/send.txt", "whitequark/masgn_const.txt", + "whitequark/pattern_matching_constants.txt", + "whitequark/pattern_matching_implicit_array_match.txt", + "whitequark/pattern_matching_single_match.txt", "whitequark/ruby_bug_12402.txt", "whitequark/ruby_bug_14690.txt", "whitequark/space_args_block.txt" @@ -81,6 +84,8 @@ class RubyParserTest < TestCase "whitequark/pattern_matching_single_line_allowed_omission_of_parentheses.txt", "whitequark/pattern_matching_single_line.txt", "whitequark/ruby_bug_11989.txt", + "whitequark/ruby_bug_18878.txt", + "whitequark/ruby_bug_19281.txt", "whitequark/slash_newline_in_heredocs.txt" ] diff --git a/test/prism/snapshots/whitequark/arg_combinations.txt b/test/prism/snapshots/whitequark/arg_combinations.txt new file mode 100644 index 00000000000..cbd47757343 --- /dev/null +++ b/test/prism/snapshots/whitequark/arg_combinations.txt @@ -0,0 +1,564 @@ +@ ProgramNode (location: (1,0)-(29,21)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(29,21)) + ├── flags: ∅ + └── body: (length: 15) + ├── @ DefNode (location: (1,0)-(1,13)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (1,4)-(1,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,6)-(1,8)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (1,6)-(1,8)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (1,7)-(1,8) = "b" + │ │ └── operator_loc: (1,6)-(1,7) = "&" + │ ├── body: ∅ + │ ├── locals: [:b] + │ ├── def_keyword_loc: (1,0)-(1,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (1,10)-(1,13) = "end" + ├── @ DefNode (location: (3,0)-(3,17)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (3,4)-(3,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (3,6)-(3,12)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (3,6)-(3,8)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (3,7)-(3,8) = "r" + │ │ │ └── operator_loc: (3,6)-(3,7) = "*" + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (3,10)-(3,12)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (3,11)-(3,12) = "b" + │ │ └── operator_loc: (3,10)-(3,11) = "&" + │ ├── body: ∅ + │ ├── locals: [:r, :b] + │ ├── def_keyword_loc: (3,0)-(3,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (3,14)-(3,17) = "end" + ├── @ DefNode (location: (5,0)-(5,20)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (5,4)-(5,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (5,6)-(5,15)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (5,6)-(5,8)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (5,7)-(5,8) = "r" + │ │ │ └── operator_loc: (5,6)-(5,7) = "*" + │ │ ├── posts: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (5,10)-(5,11)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :p + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (5,13)-(5,15)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (5,14)-(5,15) = "b" + │ │ └── operator_loc: (5,13)-(5,14) = "&" + │ ├── body: ∅ + │ ├── locals: [:r, :p, :b] + │ ├── def_keyword_loc: (5,0)-(5,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (5,17)-(5,20) = "end" + ├── @ DefNode (location: (7,0)-(7,11)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (7,4)-(7,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: ∅ + │ ├── body: ∅ + │ ├── locals: [] + │ ├── def_keyword_loc: (7,0)-(7,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (7,8)-(7,11) = "end" + ├── @ DefNode (location: (9,0)-(9,16)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (9,4)-(9,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (9,6)-(9,11)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (9,6)-(9,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (9,9)-(9,11)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (9,10)-(9,11) = "b" + │ │ └── operator_loc: (9,9)-(9,10) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :b] + │ ├── def_keyword_loc: (9,0)-(9,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (9,13)-(9,16) = "end" + ├── @ DefNode (location: (11,0)-(11,20)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (11,4)-(11,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (11,6)-(11,15)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (11,6)-(11,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 0) + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (11,9)-(11,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (11,10)-(11,11) = "r" + │ │ │ └── operator_loc: (11,9)-(11,10) = "*" + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (11,13)-(11,15)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (11,14)-(11,15) = "b" + │ │ └── operator_loc: (11,13)-(11,14) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :r, :b] + │ ├── def_keyword_loc: (11,0)-(11,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (11,17)-(11,20) = "end" + ├── @ DefNode (location: (13,0)-(13,23)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (13,4)-(13,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (13,6)-(13,18)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (13,6)-(13,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 0) + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (13,9)-(13,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (13,10)-(13,11) = "r" + │ │ │ └── operator_loc: (13,9)-(13,10) = "*" + │ │ ├── posts: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (13,13)-(13,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :p + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (13,16)-(13,18)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (13,17)-(13,18) = "b" + │ │ └── operator_loc: (13,16)-(13,17) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :r, :p, :b] + │ ├── def_keyword_loc: (13,0)-(13,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (13,20)-(13,23) = "end" + ├── @ DefNode (location: (15,0)-(15,21)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (15,4)-(15,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (15,6)-(15,16)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (15,6)-(15,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (15,9)-(15,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (15,9)-(15,10) = "o" + │ │ │ ├── operator_loc: (15,10)-(15,11) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (15,11)-(15,12)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (15,14)-(15,16)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (15,15)-(15,16) = "b" + │ │ └── operator_loc: (15,14)-(15,15) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :o, :b] + │ ├── def_keyword_loc: (15,0)-(15,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (15,18)-(15,21) = "end" + ├── @ DefNode (location: (17,0)-(17,25)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (17,4)-(17,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (17,6)-(17,20)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (17,6)-(17,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (17,9)-(17,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (17,9)-(17,10) = "o" + │ │ │ ├── operator_loc: (17,10)-(17,11) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (17,11)-(17,12)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (17,14)-(17,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (17,15)-(17,16) = "r" + │ │ │ └── operator_loc: (17,14)-(17,15) = "*" + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (17,18)-(17,20)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (17,19)-(17,20) = "b" + │ │ └── operator_loc: (17,18)-(17,19) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :o, :r, :b] + │ ├── def_keyword_loc: (17,0)-(17,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (17,22)-(17,25) = "end" + ├── @ DefNode (location: (19,0)-(19,28)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (19,4)-(19,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (19,6)-(19,23)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (19,6)-(19,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (19,9)-(19,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (19,9)-(19,10) = "o" + │ │ │ ├── operator_loc: (19,10)-(19,11) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (19,11)-(19,12)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (19,14)-(19,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (19,15)-(19,16) = "r" + │ │ │ └── operator_loc: (19,14)-(19,15) = "*" + │ │ ├── posts: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (19,18)-(19,19)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :p + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (19,21)-(19,23)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (19,22)-(19,23) = "b" + │ │ └── operator_loc: (19,21)-(19,22) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :o, :r, :p, :b] + │ ├── def_keyword_loc: (19,0)-(19,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (19,25)-(19,28) = "end" + ├── @ DefNode (location: (21,0)-(21,24)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (21,4)-(21,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (21,6)-(21,19)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (21,6)-(21,7)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (21,9)-(21,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (21,9)-(21,10) = "o" + │ │ │ ├── operator_loc: (21,10)-(21,11) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (21,11)-(21,12)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (21,14)-(21,15)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :p + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (21,17)-(21,19)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (21,18)-(21,19) = "b" + │ │ └── operator_loc: (21,17)-(21,18) = "&" + │ ├── body: ∅ + │ ├── locals: [:a, :o, :p, :b] + │ ├── def_keyword_loc: (21,0)-(21,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (21,21)-(21,24) = "end" + ├── @ DefNode (location: (23,0)-(23,18)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (23,4)-(23,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (23,6)-(23,13)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (23,6)-(23,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (23,6)-(23,7) = "o" + │ │ │ ├── operator_loc: (23,7)-(23,8) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (23,8)-(23,9)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (23,11)-(23,13)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (23,12)-(23,13) = "b" + │ │ └── operator_loc: (23,11)-(23,12) = "&" + │ ├── body: ∅ + │ ├── locals: [:o, :b] + │ ├── def_keyword_loc: (23,0)-(23,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (23,15)-(23,18) = "end" + ├── @ DefNode (location: (25,0)-(25,22)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (25,4)-(25,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (25,6)-(25,17)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (25,6)-(25,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (25,6)-(25,7) = "o" + │ │ │ ├── operator_loc: (25,7)-(25,8) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (25,8)-(25,9)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (25,11)-(25,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (25,12)-(25,13) = "r" + │ │ │ └── operator_loc: (25,11)-(25,12) = "*" + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (25,15)-(25,17)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (25,16)-(25,17) = "b" + │ │ └── operator_loc: (25,15)-(25,16) = "&" + │ ├── body: ∅ + │ ├── locals: [:o, :r, :b] + │ ├── def_keyword_loc: (25,0)-(25,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (25,19)-(25,22) = "end" + ├── @ DefNode (location: (27,0)-(27,25)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (27,4)-(27,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (27,6)-(27,20)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 1) + │ │ │ └── @ OptionalParameterNode (location: (27,6)-(27,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :o + │ │ │ ├── name_loc: (27,6)-(27,7) = "o" + │ │ │ ├── operator_loc: (27,7)-(27,8) = "=" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (27,8)-(27,9)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── rest: + │ │ │ @ RestParameterNode (location: (27,11)-(27,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :r + │ │ │ ├── name_loc: (27,12)-(27,13) = "r" + │ │ │ └── operator_loc: (27,11)-(27,12) = "*" + │ │ ├── posts: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (27,15)-(27,16)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :p + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (27,18)-(27,20)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (27,19)-(27,20) = "b" + │ │ └── operator_loc: (27,18)-(27,19) = "&" + │ ├── body: ∅ + │ ├── locals: [:o, :r, :p, :b] + │ ├── def_keyword_loc: (27,0)-(27,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (27,22)-(27,25) = "end" + └── @ DefNode (location: (29,0)-(29,21)) + ├── flags: newline + ├── name: :f + ├── name_loc: (29,4)-(29,5) = "f" + ├── receiver: ∅ + ├── parameters: + │ @ ParametersNode (location: (29,6)-(29,16)) + │ ├── flags: ∅ + │ ├── requireds: (length: 0) + │ ├── optionals: (length: 1) + │ │ └── @ OptionalParameterNode (location: (29,6)-(29,9)) + │ │ ├── flags: ∅ + │ │ ├── name: :o + │ │ ├── name_loc: (29,6)-(29,7) = "o" + │ │ ├── operator_loc: (29,7)-(29,8) = "=" + │ │ └── value: + │ │ @ IntegerNode (location: (29,8)-(29,9)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 1 + │ ├── rest: ∅ + │ ├── posts: (length: 1) + │ │ └── @ RequiredParameterNode (location: (29,11)-(29,12)) + │ │ ├── flags: ∅ + │ │ └── name: :p + │ ├── keywords: (length: 0) + │ ├── keyword_rest: ∅ + │ └── block: + │ @ BlockParameterNode (location: (29,14)-(29,16)) + │ ├── flags: ∅ + │ ├── name: :b + │ ├── name_loc: (29,15)-(29,16) = "b" + │ └── operator_loc: (29,14)-(29,15) = "&" + ├── body: ∅ + ├── locals: [:o, :p, :b] + ├── def_keyword_loc: (29,0)-(29,3) = "def" + ├── operator_loc: ∅ + ├── lparen_loc: ∅ + ├── rparen_loc: ∅ + ├── equal_loc: ∅ + └── end_keyword_loc: (29,18)-(29,21) = "end" diff --git a/test/prism/snapshots/whitequark/block_arg_combinations.txt b/test/prism/snapshots/whitequark/block_arg_combinations.txt new file mode 100644 index 00000000000..733f1ad6b51 --- /dev/null +++ b/test/prism/snapshots/whitequark/block_arg_combinations.txt @@ -0,0 +1,1151 @@ +@ ProgramNode (location: (1,0)-(57,7)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(57,7)) + ├── flags: ∅ + └── body: (length: 28) + ├── @ CallNode (location: (1,0)-(1,5)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (1,0)-(1,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (1,1)-(1,5)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: ∅ + │ ├── body: ∅ + │ ├── opening_loc: (1,1)-(1,2) = "{" + │ └── closing_loc: (1,4)-(1,5) = "}" + ├── @ CallNode (location: (3,0)-(3,8)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (3,0)-(3,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (3,1)-(3,8)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (3,3)-(3,6)) + │ │ ├── flags: ∅ + │ │ ├── parameters: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (3,3)-(3,4) = "|" + │ │ └── closing_loc: (3,5)-(3,6) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (3,1)-(3,2) = "{" + │ └── closing_loc: (3,7)-(3,8) = "}" + ├── @ CallNode (location: (5,0)-(5,9)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (5,0)-(5,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (5,1)-(5,9)) + │ ├── flags: ∅ + │ ├── locals: [:b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (5,3)-(5,7)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (5,4)-(5,6)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (5,4)-(5,6)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (5,5)-(5,6) = "b" + │ │ │ └── operator_loc: (5,4)-(5,5) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (5,3)-(5,4) = "|" + │ │ └── closing_loc: (5,6)-(5,7) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (5,1)-(5,2) = "{" + │ └── closing_loc: (5,8)-(5,9) = "}" + ├── @ CallNode (location: (7,0)-(7,12)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (7,0)-(7,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (7,1)-(7,12)) + │ ├── flags: ∅ + │ ├── locals: [:b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (7,3)-(7,10)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (7,4)-(7,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (7,4)-(7,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: ∅ + │ │ │ │ ├── name_loc: ∅ + │ │ │ │ └── operator_loc: (7,4)-(7,5) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (7,7)-(7,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (7,8)-(7,9) = "b" + │ │ │ └── operator_loc: (7,7)-(7,8) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (7,3)-(7,4) = "|" + │ │ └── closing_loc: (7,9)-(7,10) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (7,1)-(7,2) = "{" + │ └── closing_loc: (7,11)-(7,12) = "}" + ├── @ CallNode (location: (9,0)-(9,16)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (9,0)-(9,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (9,1)-(9,16)) + │ ├── flags: ∅ + │ ├── locals: [:r, :p, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (9,3)-(9,14)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (9,4)-(9,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (9,4)-(9,6)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :r + │ │ │ │ ├── name_loc: (9,5)-(9,6) = "r" + │ │ │ │ └── operator_loc: (9,4)-(9,5) = "*" + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (9,8)-(9,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (9,11)-(9,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (9,12)-(9,13) = "b" + │ │ │ └── operator_loc: (9,11)-(9,12) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (9,3)-(9,4) = "|" + │ │ └── closing_loc: (9,13)-(9,14) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (9,1)-(9,2) = "{" + │ └── closing_loc: (9,15)-(9,16) = "}" + ├── @ CallNode (location: (11,0)-(11,13)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (11,0)-(11,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (11,1)-(11,13)) + │ ├── flags: ∅ + │ ├── locals: [:s, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (11,3)-(11,11)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (11,4)-(11,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (11,4)-(11,6)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :s + │ │ │ │ ├── name_loc: (11,5)-(11,6) = "s" + │ │ │ │ └── operator_loc: (11,4)-(11,5) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (11,8)-(11,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (11,9)-(11,10) = "b" + │ │ │ └── operator_loc: (11,8)-(11,9) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (11,3)-(11,4) = "|" + │ │ └── closing_loc: (11,10)-(11,11) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (11,1)-(11,2) = "{" + │ └── closing_loc: (11,12)-(11,13) = "}" + ├── @ CallNode (location: (13,0)-(13,9)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (13,0)-(13,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (13,1)-(13,9)) + │ ├── flags: ∅ + │ ├── locals: [:s] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (13,3)-(13,7)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (13,4)-(13,6)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (13,4)-(13,6)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :s + │ │ │ │ ├── name_loc: (13,5)-(13,6) = "s" + │ │ │ │ └── operator_loc: (13,4)-(13,5) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (13,3)-(13,4) = "|" + │ │ └── closing_loc: (13,6)-(13,7) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (13,1)-(13,2) = "{" + │ └── closing_loc: (13,8)-(13,9) = "}" + ├── @ CallNode (location: (15,0)-(15,8)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (15,0)-(15,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (15,1)-(15,8)) + │ ├── flags: ∅ + │ ├── locals: [] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (15,3)-(15,6)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (15,4)-(15,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (15,4)-(15,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: ∅ + │ │ │ │ ├── name_loc: ∅ + │ │ │ │ └── operator_loc: (15,4)-(15,5) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (15,3)-(15,4) = "|" + │ │ └── closing_loc: (15,5)-(15,6) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (15,1)-(15,2) = "{" + │ └── closing_loc: (15,7)-(15,8) = "}" + ├── @ CallNode (location: (17,0)-(19,3)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (17,0)-(17,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (17,1)-(19,3)) + │ ├── flags: ∅ + │ ├── locals: [:a] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (17,3)-(19,1)) + │ │ ├── flags: ∅ + │ │ ├── parameters: ∅ + │ │ ├── locals: (length: 1) + │ │ │ └── @ BlockLocalVariableNode (location: (18,0)-(18,1)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── opening_loc: (17,3)-(17,4) = "|" + │ │ └── closing_loc: (19,0)-(19,1) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (17,1)-(17,2) = "{" + │ └── closing_loc: (19,2)-(19,3) = "}" + ├── @ CallNode (location: (21,0)-(21,9)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (21,0)-(21,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (21,1)-(21,9)) + │ ├── flags: ∅ + │ ├── locals: [:a] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (21,3)-(21,7)) + │ │ ├── flags: ∅ + │ │ ├── parameters: ∅ + │ │ ├── locals: (length: 1) + │ │ │ └── @ BlockLocalVariableNode (location: (21,5)-(21,6)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── opening_loc: (21,3)-(21,4) = "|" + │ │ └── closing_loc: (21,6)-(21,7) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (21,1)-(21,2) = "{" + │ └── closing_loc: (21,8)-(21,9) = "}" + ├── @ CallNode (location: (23,0)-(23,12)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (23,0)-(23,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (23,1)-(23,12)) + │ ├── flags: ∅ + │ ├── locals: [:a, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (23,3)-(23,10)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (23,4)-(23,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (23,4)-(23,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (23,7)-(23,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (23,8)-(23,9) = "b" + │ │ │ └── operator_loc: (23,7)-(23,8) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (23,3)-(23,4) = "|" + │ │ └── closing_loc: (23,9)-(23,10) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (23,1)-(23,2) = "{" + │ └── closing_loc: (23,11)-(23,12) = "}" + ├── @ CallNode (location: (25,0)-(25,15)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (25,0)-(25,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (25,1)-(25,15)) + │ ├── flags: ∅ + │ ├── locals: [:a, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (25,3)-(25,13)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (25,4)-(25,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (25,4)-(25,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (25,7)-(25,8)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: ∅ + │ │ │ │ ├── name_loc: ∅ + │ │ │ │ └── operator_loc: (25,7)-(25,8) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (25,10)-(25,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (25,11)-(25,12) = "b" + │ │ │ └── operator_loc: (25,10)-(25,11) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (25,3)-(25,4) = "|" + │ │ └── closing_loc: (25,12)-(25,13) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (25,1)-(25,2) = "{" + │ └── closing_loc: (25,14)-(25,15) = "}" + ├── @ CallNode (location: (27,0)-(27,19)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (27,0)-(27,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (27,1)-(27,19)) + │ ├── flags: ∅ + │ ├── locals: [:a, :r, :p, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (27,3)-(27,17)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (27,4)-(27,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (27,4)-(27,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (27,7)-(27,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :r + │ │ │ │ ├── name_loc: (27,8)-(27,9) = "r" + │ │ │ │ └── operator_loc: (27,7)-(27,8) = "*" + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (27,11)-(27,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (27,14)-(27,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (27,15)-(27,16) = "b" + │ │ │ └── operator_loc: (27,14)-(27,15) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (27,3)-(27,4) = "|" + │ │ └── closing_loc: (27,16)-(27,17) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (27,1)-(27,2) = "{" + │ └── closing_loc: (27,18)-(27,19) = "}" + ├── @ CallNode (location: (29,0)-(29,16)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (29,0)-(29,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (29,1)-(29,16)) + │ ├── flags: ∅ + │ ├── locals: [:a, :s, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (29,3)-(29,14)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (29,4)-(29,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (29,4)-(29,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (29,7)-(29,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :s + │ │ │ │ ├── name_loc: (29,8)-(29,9) = "s" + │ │ │ │ └── operator_loc: (29,7)-(29,8) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (29,11)-(29,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (29,12)-(29,13) = "b" + │ │ │ └── operator_loc: (29,11)-(29,12) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (29,3)-(29,4) = "|" + │ │ └── closing_loc: (29,13)-(29,14) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (29,1)-(29,2) = "{" + │ └── closing_loc: (29,15)-(29,16) = "}" + ├── @ CallNode (location: (31,0)-(31,12)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (31,0)-(31,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (31,1)-(31,12)) + │ ├── flags: ∅ + │ ├── locals: [:a, :s] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (31,3)-(31,10)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (31,4)-(31,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (31,4)-(31,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (31,7)-(31,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :s + │ │ │ │ ├── name_loc: (31,8)-(31,9) = "s" + │ │ │ │ └── operator_loc: (31,7)-(31,8) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (31,3)-(31,4) = "|" + │ │ └── closing_loc: (31,9)-(31,10) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (31,1)-(31,2) = "{" + │ └── closing_loc: (31,11)-(31,12) = "}" + ├── @ CallNode (location: (33,0)-(33,11)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (33,0)-(33,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (33,1)-(33,11)) + │ ├── flags: ∅ + │ ├── locals: [:a] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (33,3)-(33,9)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (33,4)-(33,8)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (33,4)-(33,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (33,7)-(33,8)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: ∅ + │ │ │ │ ├── name_loc: ∅ + │ │ │ │ └── operator_loc: (33,7)-(33,8) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (33,3)-(33,4) = "|" + │ │ └── closing_loc: (33,8)-(33,9) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (33,1)-(33,2) = "{" + │ └── closing_loc: (33,10)-(33,11) = "}" + ├── @ CallNode (location: (35,0)-(35,11)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (35,0)-(35,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (35,1)-(35,11)) + │ ├── flags: ∅ + │ ├── locals: [:a, :c] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (35,3)-(35,9)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (35,4)-(35,8)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ RequiredParameterNode (location: (35,4)-(35,5)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── name: :a + │ │ │ │ └── @ RequiredParameterNode (location: (35,7)-(35,8)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :c + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (35,3)-(35,4) = "|" + │ │ └── closing_loc: (35,8)-(35,9) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (35,1)-(35,2) = "{" + │ └── closing_loc: (35,10)-(35,11) = "}" + ├── @ CallNode (location: (37,0)-(37,17)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (37,0)-(37,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (37,1)-(37,17)) + │ ├── flags: ∅ + │ ├── locals: [:a, :o, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (37,3)-(37,15)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (37,4)-(37,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (37,4)-(37,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (37,7)-(37,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (37,7)-(37,8) = "o" + │ │ │ │ ├── operator_loc: (37,8)-(37,9) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (37,9)-(37,10)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (37,12)-(37,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (37,13)-(37,14) = "b" + │ │ │ └── operator_loc: (37,12)-(37,13) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (37,3)-(37,4) = "|" + │ │ └── closing_loc: (37,14)-(37,15) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (37,1)-(37,2) = "{" + │ └── closing_loc: (37,16)-(37,17) = "}" + ├── @ CallNode (location: (39,0)-(39,24)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (39,0)-(39,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (39,1)-(39,24)) + │ ├── flags: ∅ + │ ├── locals: [:a, :o, :r, :p, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (39,3)-(39,22)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (39,4)-(39,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (39,4)-(39,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (39,7)-(39,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (39,7)-(39,8) = "o" + │ │ │ │ ├── operator_loc: (39,8)-(39,9) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (39,9)-(39,10)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (39,12)-(39,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :r + │ │ │ │ ├── name_loc: (39,13)-(39,14) = "r" + │ │ │ │ └── operator_loc: (39,12)-(39,13) = "*" + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (39,16)-(39,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (39,19)-(39,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (39,20)-(39,21) = "b" + │ │ │ └── operator_loc: (39,19)-(39,20) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (39,3)-(39,4) = "|" + │ │ └── closing_loc: (39,21)-(39,22) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (39,1)-(39,2) = "{" + │ └── closing_loc: (39,23)-(39,24) = "}" + ├── @ CallNode (location: (41,0)-(41,27)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (41,0)-(41,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (41,1)-(41,27)) + │ ├── flags: ∅ + │ ├── locals: [:a, :o, :o1, :r, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (41,3)-(41,25)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (41,4)-(41,24)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (41,4)-(41,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 2) + │ │ │ │ ├── @ OptionalParameterNode (location: (41,7)-(41,10)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :o + │ │ │ │ │ ├── name_loc: (41,7)-(41,8) = "o" + │ │ │ │ │ ├── operator_loc: (41,8)-(41,9) = "=" + │ │ │ │ │ └── value: + │ │ │ │ │ @ IntegerNode (location: (41,9)-(41,10)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── @ OptionalParameterNode (location: (41,12)-(41,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o1 + │ │ │ │ ├── name_loc: (41,12)-(41,14) = "o1" + │ │ │ │ ├── operator_loc: (41,14)-(41,15) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (41,15)-(41,16)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (41,18)-(41,20)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :r + │ │ │ │ ├── name_loc: (41,19)-(41,20) = "r" + │ │ │ │ └── operator_loc: (41,18)-(41,19) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (41,22)-(41,24)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (41,23)-(41,24) = "b" + │ │ │ └── operator_loc: (41,22)-(41,23) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (41,3)-(41,4) = "|" + │ │ └── closing_loc: (41,24)-(41,25) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (41,1)-(41,2) = "{" + │ └── closing_loc: (41,26)-(41,27) = "}" + ├── @ CallNode (location: (43,0)-(43,20)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (43,0)-(43,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (43,1)-(43,20)) + │ ├── flags: ∅ + │ ├── locals: [:a, :o, :p, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (43,3)-(43,18)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (43,4)-(43,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (43,4)-(43,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (43,7)-(43,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (43,7)-(43,8) = "o" + │ │ │ │ ├── operator_loc: (43,8)-(43,9) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (43,9)-(43,10)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (43,12)-(43,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (43,15)-(43,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (43,16)-(43,17) = "b" + │ │ │ └── operator_loc: (43,15)-(43,16) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (43,3)-(43,4) = "|" + │ │ └── closing_loc: (43,17)-(43,18) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (43,1)-(43,2) = "{" + │ └── closing_loc: (43,19)-(43,20) = "}" + ├── @ CallNode (location: (45,0)-(45,9)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (45,0)-(45,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (45,1)-(45,9)) + │ ├── flags: ∅ + │ ├── locals: [:a] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (45,3)-(45,7)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (45,4)-(45,6)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (45,4)-(45,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ ImplicitRestNode (location: (45,5)-(45,6)) + │ │ │ │ └── flags: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (45,3)-(45,4) = "|" + │ │ └── closing_loc: (45,6)-(45,7) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (45,1)-(45,2) = "{" + │ └── closing_loc: (45,8)-(45,9) = "}" + ├── @ CallNode (location: (47,0)-(47,8)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (47,0)-(47,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (47,1)-(47,8)) + │ ├── flags: ∅ + │ ├── locals: [:a] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (47,3)-(47,6)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (47,4)-(47,5)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (47,4)-(47,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: ∅ + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (47,3)-(47,4) = "|" + │ │ └── closing_loc: (47,5)-(47,6) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (47,1)-(47,2) = "{" + │ └── closing_loc: (47,7)-(47,8) = "}" + ├── @ CallNode (location: (49,0)-(49,14)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (49,0)-(49,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (49,1)-(49,14)) + │ ├── flags: ∅ + │ ├── locals: [:o, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (49,3)-(49,12)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (49,4)-(49,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (49,4)-(49,7)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (49,4)-(49,5) = "o" + │ │ │ │ ├── operator_loc: (49,5)-(49,6) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (49,6)-(49,7)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (49,9)-(49,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (49,10)-(49,11) = "b" + │ │ │ └── operator_loc: (49,9)-(49,10) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (49,3)-(49,4) = "|" + │ │ └── closing_loc: (49,11)-(49,12) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (49,1)-(49,2) = "{" + │ └── closing_loc: (49,13)-(49,14) = "}" + ├── @ CallNode (location: (51,0)-(51,18)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (51,0)-(51,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (51,1)-(51,18)) + │ ├── flags: ∅ + │ ├── locals: [:o, :r, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (51,3)-(51,16)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (51,4)-(51,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (51,4)-(51,7)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (51,4)-(51,5) = "o" + │ │ │ │ ├── operator_loc: (51,5)-(51,6) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (51,6)-(51,7)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (51,9)-(51,11)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :r + │ │ │ │ ├── name_loc: (51,10)-(51,11) = "r" + │ │ │ │ └── operator_loc: (51,9)-(51,10) = "*" + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (51,13)-(51,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (51,14)-(51,15) = "b" + │ │ │ └── operator_loc: (51,13)-(51,14) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (51,3)-(51,4) = "|" + │ │ └── closing_loc: (51,15)-(51,16) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (51,1)-(51,2) = "{" + │ └── closing_loc: (51,17)-(51,18) = "}" + ├── @ CallNode (location: (53,0)-(53,21)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (53,0)-(53,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (53,1)-(53,21)) + │ ├── flags: ∅ + │ ├── locals: [:o, :r, :p, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (53,3)-(53,19)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (53,4)-(53,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (53,4)-(53,7)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (53,4)-(53,5) = "o" + │ │ │ │ ├── operator_loc: (53,5)-(53,6) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (53,6)-(53,7)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: + │ │ │ │ @ RestParameterNode (location: (53,9)-(53,11)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :r + │ │ │ │ ├── name_loc: (53,10)-(53,11) = "r" + │ │ │ │ └── operator_loc: (53,9)-(53,10) = "*" + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (53,13)-(53,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (53,16)-(53,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (53,17)-(53,18) = "b" + │ │ │ └── operator_loc: (53,16)-(53,17) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (53,3)-(53,4) = "|" + │ │ └── closing_loc: (53,18)-(53,19) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (53,1)-(53,2) = "{" + │ └── closing_loc: (53,20)-(53,21) = "}" + ├── @ CallNode (location: (55,0)-(55,17)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (55,0)-(55,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (55,1)-(55,17)) + │ ├── flags: ∅ + │ ├── locals: [:o, :p, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (55,3)-(55,15)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (55,4)-(55,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 1) + │ │ │ │ └── @ OptionalParameterNode (location: (55,4)-(55,7)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :o + │ │ │ │ ├── name_loc: (55,4)-(55,5) = "o" + │ │ │ │ ├── operator_loc: (55,5)-(55,6) = "=" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (55,6)-(55,7)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (55,9)-(55,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (55,12)-(55,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (55,13)-(55,14) = "b" + │ │ │ └── operator_loc: (55,12)-(55,13) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (55,3)-(55,4) = "|" + │ │ └── closing_loc: (55,14)-(55,15) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (55,1)-(55,2) = "{" + │ └── closing_loc: (55,16)-(55,17) = "}" + └── @ CallNode (location: (57,0)-(57,7)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :f + ├── message_loc: (57,0)-(57,1) = "f" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (57,1)-(57,7)) + ├── flags: ∅ + ├── locals: [] + ├── parameters: + │ @ BlockParametersNode (location: (57,3)-(57,5)) + │ ├── flags: ∅ + │ ├── parameters: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (57,3)-(57,4) = "|" + │ └── closing_loc: (57,4)-(57,5) = "|" + ├── body: ∅ + ├── opening_loc: (57,1)-(57,2) = "{" + └── closing_loc: (57,6)-(57,7) = "}" diff --git a/test/prism/snapshots/whitequark/block_kwarg.txt b/test/prism/snapshots/whitequark/block_kwarg.txt new file mode 100644 index 00000000000..65e827fb5b2 --- /dev/null +++ b/test/prism/snapshots/whitequark/block_kwarg.txt @@ -0,0 +1,43 @@ +@ ProgramNode (location: (1,0)-(1,11)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,11)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,11)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :f + ├── message_loc: (1,0)-(1,1) = "f" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,1)-(1,11)) + ├── flags: ∅ + ├── locals: [:foo] + ├── parameters: + │ @ BlockParametersNode (location: (1,3)-(1,9)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,4)-(1,8)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 1) + │ │ │ └── @ RequiredKeywordParameterNode (location: (1,4)-(1,8)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :foo + │ │ │ └── name_loc: (1,4)-(1,8) = "foo:" + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (1,3)-(1,4) = "|" + │ └── closing_loc: (1,8)-(1,9) = "|" + ├── body: ∅ + ├── opening_loc: (1,1)-(1,2) = "{" + └── closing_loc: (1,10)-(1,11) = "}" diff --git a/test/prism/snapshots/whitequark/block_kwarg_combinations.txt b/test/prism/snapshots/whitequark/block_kwarg_combinations.txt new file mode 100644 index 00000000000..ec1659a941e --- /dev/null +++ b/test/prism/snapshots/whitequark/block_kwarg_combinations.txt @@ -0,0 +1,152 @@ +@ ProgramNode (location: (1,0)-(5,32)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(5,32)) + ├── flags: ∅ + └── body: (length: 3) + ├── @ CallNode (location: (1,0)-(1,16)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (1,0)-(1,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (1,1)-(1,16)) + │ ├── flags: ∅ + │ ├── locals: [:baz, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (1,3)-(1,14)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (1,4)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 0) + │ │ │ ├── keyword_rest: + │ │ │ │ @ KeywordRestParameterNode (location: (1,4)-(1,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :baz + │ │ │ │ ├── name_loc: (1,6)-(1,9) = "baz" + │ │ │ │ └── operator_loc: (1,4)-(1,6) = "**" + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (1,11)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (1,12)-(1,13) = "b" + │ │ │ └── operator_loc: (1,11)-(1,12) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (1,3)-(1,4) = "|" + │ │ └── closing_loc: (1,13)-(1,14) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (1,1)-(1,2) = "{" + │ └── closing_loc: (1,15)-(1,16) = "}" + ├── @ CallNode (location: (3,0)-(3,17)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :f + │ ├── message_loc: (3,0)-(3,1) = "f" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: + │ @ BlockNode (location: (3,1)-(3,17)) + │ ├── flags: ∅ + │ ├── locals: [:foo, :b] + │ ├── parameters: + │ │ @ BlockParametersNode (location: (3,3)-(3,15)) + │ │ ├── flags: ∅ + │ │ ├── parameters: + │ │ │ @ ParametersNode (location: (3,4)-(3,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── optionals: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── keywords: (length: 1) + │ │ │ │ └── @ OptionalKeywordParameterNode (location: (3,4)-(3,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :foo + │ │ │ │ ├── name_loc: (3,4)-(3,8) = "foo:" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (3,9)-(3,10)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── keyword_rest: ∅ + │ │ │ └── block: + │ │ │ @ BlockParameterNode (location: (3,12)-(3,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :b + │ │ │ ├── name_loc: (3,13)-(3,14) = "b" + │ │ │ └── operator_loc: (3,12)-(3,13) = "&" + │ │ ├── locals: (length: 0) + │ │ ├── opening_loc: (3,3)-(3,4) = "|" + │ │ └── closing_loc: (3,14)-(3,15) = "|" + │ ├── body: ∅ + │ ├── opening_loc: (3,1)-(3,2) = "{" + │ └── closing_loc: (3,16)-(3,17) = "}" + └── @ CallNode (location: (5,0)-(5,32)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :f + ├── message_loc: (5,0)-(5,1) = "f" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (5,1)-(5,32)) + ├── flags: ∅ + ├── locals: [:foo, :bar, :baz, :b] + ├── parameters: + │ @ BlockParametersNode (location: (5,3)-(5,30)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (5,4)-(5,29)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 2) + │ │ │ ├── @ OptionalKeywordParameterNode (location: (5,4)-(5,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :foo + │ │ │ │ ├── name_loc: (5,4)-(5,8) = "foo:" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (5,9)-(5,10)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── @ OptionalKeywordParameterNode (location: (5,12)-(5,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── name_loc: (5,12)-(5,16) = "bar:" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (5,17)-(5,18)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ ├── keyword_rest: + │ │ │ @ KeywordRestParameterNode (location: (5,20)-(5,25)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :baz + │ │ │ ├── name_loc: (5,22)-(5,25) = "baz" + │ │ │ └── operator_loc: (5,20)-(5,22) = "**" + │ │ └── block: + │ │ @ BlockParameterNode (location: (5,27)-(5,29)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (5,28)-(5,29) = "b" + │ │ └── operator_loc: (5,27)-(5,28) = "&" + │ ├── locals: (length: 0) + │ ├── opening_loc: (5,3)-(5,4) = "|" + │ └── closing_loc: (5,29)-(5,30) = "|" + ├── body: ∅ + ├── opening_loc: (5,1)-(5,2) = "{" + └── closing_loc: (5,31)-(5,32) = "}" diff --git a/test/prism/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt b/test/prism/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt new file mode 100644 index 00000000000..aebe56988e5 --- /dev/null +++ b/test/prism/snapshots/whitequark/emit_arg_inside_procarg0_legacy.txt @@ -0,0 +1,42 @@ +@ ProgramNode (location: (1,0)-(1,8)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,8)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,8)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :f + ├── message_loc: (1,0)-(1,1) = "f" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,1)-(1,8)) + ├── flags: ∅ + ├── locals: [:a] + ├── parameters: + │ @ BlockParametersNode (location: (1,3)-(1,6)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,4)-(1,5)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (1,4)-(1,5)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (1,3)-(1,4) = "|" + │ └── closing_loc: (1,5)-(1,6) = "|" + ├── body: ∅ + ├── opening_loc: (1,1)-(1,2) = "{" + └── closing_loc: (1,7)-(1,8) = "}" diff --git a/test/prism/snapshots/whitequark/find_pattern.txt b/test/prism/snapshots/whitequark/find_pattern.txt new file mode 100644 index 00000000000..8a58386c4e8 --- /dev/null +++ b/test/prism/snapshots/whitequark/find_pattern.txt @@ -0,0 +1,218 @@ +@ ProgramNode (location: (1,0)-(7,44)) +├── flags: ∅ +├── locals: [:x, :a, :y] +└── statements: + @ StatementsNode (location: (1,0)-(7,44)) + ├── flags: ∅ + └── body: (length: 4) + ├── @ CaseMatchNode (location: (1,0)-(1,36)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,31)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ FindPatternNode (location: (1,13)-(1,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── left: + │ │ │ │ @ SplatNode (location: (1,13)-(1,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (1,13)-(1,14) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (1,16)-(1,18)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 42 + │ │ │ ├── right: + │ │ │ │ @ SplatNode (location: (1,20)-(1,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (1,20)-(1,21) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,27)-(1,31)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (1,27)-(1,31)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: (1,22)-(1,26) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,33)-(1,36) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,42)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,37)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ FindPatternNode (location: (3,13)-(3,27)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (3,13)-(3,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :Array + │ │ │ ├── left: + │ │ │ │ @ SplatNode (location: (3,19)-(3,20)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (3,19)-(3,20) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (3,22)-(3,23)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── right: + │ │ │ │ @ SplatNode (location: (3,25)-(3,26)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (3,25)-(3,26) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── opening_loc: (3,18)-(3,19) = "[" + │ │ │ └── closing_loc: (3,26)-(3,27) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,33)-(3,37)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (3,33)-(3,37)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,28)-(3,32) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,39)-(3,42) = "end" + ├── @ CaseMatchNode (location: (5,0)-(5,43)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (5,5)-(5,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (5,5)-(5,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (5,10)-(5,38)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ FindPatternNode (location: (5,13)-(5,28)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (5,13)-(5,19)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :String + │ │ │ ├── left: + │ │ │ │ @ SplatNode (location: (5,20)-(5,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (5,20)-(5,21) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (5,23)-(5,24)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── right: + │ │ │ │ @ SplatNode (location: (5,26)-(5,27)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (5,26)-(5,27) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── opening_loc: (5,19)-(5,20) = "(" + │ │ │ └── closing_loc: (5,27)-(5,28) = ")" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,34)-(5,38)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (5,34)-(5,38)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (5,10)-(5,12) = "in" + │ │ └── then_loc: (5,29)-(5,33) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (5,0)-(5,4) = "case" + │ └── end_keyword_loc: (5,40)-(5,43) = "end" + └── @ CaseMatchNode (location: (7,0)-(7,44)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (7,5)-(7,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (7,5)-(7,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (7,10)-(7,39)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ FindPatternNode (location: (7,13)-(7,29)) + │ │ ├── flags: ∅ + │ │ ├── constant: ∅ + │ │ ├── left: + │ │ │ @ SplatNode (location: (7,14)-(7,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── operator_loc: (7,14)-(7,15) = "*" + │ │ │ └── expression: + │ │ │ @ LocalVariableTargetNode (location: (7,15)-(7,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :x + │ │ │ └── depth: 0 + │ │ ├── requireds: (length: 1) + │ │ │ └── @ CapturePatternNode (location: (7,18)-(7,24)) + │ │ │ ├── flags: ∅ + │ │ │ ├── value: + │ │ │ │ @ IntegerNode (location: (7,18)-(7,19)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── target: + │ │ │ │ @ LocalVariableTargetNode (location: (7,23)-(7,24)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 + │ │ │ └── operator_loc: (7,20)-(7,22) = "=>" + │ │ ├── right: + │ │ │ @ SplatNode (location: (7,26)-(7,28)) + │ │ │ ├── flags: ∅ + │ │ │ ├── operator_loc: (7,26)-(7,27) = "*" + │ │ │ └── expression: + │ │ │ @ LocalVariableTargetNode (location: (7,27)-(7,28)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :y + │ │ │ └── depth: 0 + │ │ ├── opening_loc: (7,13)-(7,14) = "[" + │ │ └── closing_loc: (7,28)-(7,29) = "]" + │ ├── statements: + │ │ @ StatementsNode (location: (7,35)-(7,39)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (7,35)-(7,39)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (7,10)-(7,12) = "in" + │ └── then_loc: (7,30)-(7,34) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (7,0)-(7,4) = "case" + └── end_keyword_loc: (7,41)-(7,44) = "end" diff --git a/test/prism/snapshots/whitequark/kwarg_combinations.txt b/test/prism/snapshots/whitequark/kwarg_combinations.txt new file mode 100644 index 00000000000..bf68d1ef49b --- /dev/null +++ b/test/prism/snapshots/whitequark/kwarg_combinations.txt @@ -0,0 +1,158 @@ +@ ProgramNode (location: (1,0)-(7,16)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(7,16)) + ├── flags: ∅ + └── body: (length: 4) + ├── @ DefNode (location: (1,0)-(1,23)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (1,4)-(1,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,7)-(1,17)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 1) + │ │ │ └── @ OptionalKeywordParameterNode (location: (1,7)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :foo + │ │ │ ├── name_loc: (1,7)-(1,11) = "foo:" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (1,12)-(1,13)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── keyword_rest: ∅ + │ │ └── block: + │ │ @ BlockParameterNode (location: (1,15)-(1,17)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (1,16)-(1,17) = "b" + │ │ └── operator_loc: (1,15)-(1,16) = "&" + │ ├── body: ∅ + │ ├── locals: [:foo, :b] + │ ├── def_keyword_loc: (1,0)-(1,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (1,6)-(1,7) = "(" + │ ├── rparen_loc: (1,17)-(1,18) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (1,20)-(1,23) = "end" + ├── @ DefNode (location: (3,0)-(3,38)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (3,4)-(3,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (3,7)-(3,32)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 2) + │ │ │ ├── @ OptionalKeywordParameterNode (location: (3,7)-(3,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :foo + │ │ │ │ ├── name_loc: (3,7)-(3,11) = "foo:" + │ │ │ │ └── value: + │ │ │ │ @ IntegerNode (location: (3,12)-(3,13)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ └── @ OptionalKeywordParameterNode (location: (3,15)-(3,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :bar + │ │ │ ├── name_loc: (3,15)-(3,19) = "bar:" + │ │ │ └── value: + │ │ │ @ IntegerNode (location: (3,20)-(3,21)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ ├── keyword_rest: + │ │ │ @ KeywordRestParameterNode (location: (3,23)-(3,28)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :baz + │ │ │ ├── name_loc: (3,25)-(3,28) = "baz" + │ │ │ └── operator_loc: (3,23)-(3,25) = "**" + │ │ └── block: + │ │ @ BlockParameterNode (location: (3,30)-(3,32)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (3,31)-(3,32) = "b" + │ │ └── operator_loc: (3,30)-(3,31) = "&" + │ ├── body: ∅ + │ ├── locals: [:foo, :bar, :baz, :b] + │ ├── def_keyword_loc: (3,0)-(3,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (3,6)-(3,7) = "(" + │ ├── rparen_loc: (3,32)-(3,33) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (3,35)-(3,38) = "end" + ├── @ DefNode (location: (5,0)-(5,20)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (5,4)-(5,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (5,6)-(5,15)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: + │ │ │ @ KeywordRestParameterNode (location: (5,6)-(5,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :baz + │ │ │ ├── name_loc: (5,8)-(5,11) = "baz" + │ │ │ └── operator_loc: (5,6)-(5,8) = "**" + │ │ └── block: + │ │ @ BlockParameterNode (location: (5,13)-(5,15)) + │ │ ├── flags: ∅ + │ │ ├── name: :b + │ │ ├── name_loc: (5,14)-(5,15) = "b" + │ │ └── operator_loc: (5,13)-(5,14) = "&" + │ ├── body: ∅ + │ ├── locals: [:baz, :b] + │ ├── def_keyword_loc: (5,0)-(5,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (5,17)-(5,20) = "end" + └── @ DefNode (location: (7,0)-(7,16)) + ├── flags: newline + ├── name: :f + ├── name_loc: (7,4)-(7,5) = "f" + ├── receiver: ∅ + ├── parameters: + │ @ ParametersNode (location: (7,6)-(7,11)) + │ ├── flags: ∅ + │ ├── requireds: (length: 0) + │ ├── optionals: (length: 0) + │ ├── rest: + │ │ @ RestParameterNode (location: (7,6)-(7,7)) + │ │ ├── flags: ∅ + │ │ ├── name: ∅ + │ │ ├── name_loc: ∅ + │ │ └── operator_loc: (7,6)-(7,7) = "*" + │ ├── posts: (length: 0) + │ ├── keywords: (length: 0) + │ ├── keyword_rest: + │ │ @ KeywordRestParameterNode (location: (7,9)-(7,11)) + │ │ ├── flags: ∅ + │ │ ├── name: ∅ + │ │ ├── name_loc: ∅ + │ │ └── operator_loc: (7,9)-(7,11) = "**" + │ └── block: ∅ + ├── body: ∅ + ├── locals: [] + ├── def_keyword_loc: (7,0)-(7,3) = "def" + ├── operator_loc: ∅ + ├── lparen_loc: ∅ + ├── rparen_loc: ∅ + ├── equal_loc: ∅ + └── end_keyword_loc: (7,13)-(7,16) = "end" diff --git a/test/prism/snapshots/whitequark/kwarg_no_paren.txt b/test/prism/snapshots/whitequark/kwarg_no_paren.txt new file mode 100644 index 00000000000..0d5c858e0ca --- /dev/null +++ b/test/prism/snapshots/whitequark/kwarg_no_paren.txt @@ -0,0 +1,65 @@ +@ ProgramNode (location: (1,0)-(5,5)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(5,5)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ DefNode (location: (1,0)-(2,5)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (1,4)-(1,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,6)-(1,10)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 0) + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 1) + │ │ │ └── @ RequiredKeywordParameterNode (location: (1,6)-(1,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :foo + │ │ │ └── name_loc: (1,6)-(1,10) = "foo:" + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:foo] + │ ├── def_keyword_loc: (1,0)-(1,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: ∅ + │ ├── rparen_loc: ∅ + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (2,2)-(2,5) = "end" + └── @ DefNode (location: (4,0)-(5,5)) + ├── flags: newline + ├── name: :f + ├── name_loc: (4,4)-(4,5) = "f" + ├── receiver: ∅ + ├── parameters: + │ @ ParametersNode (location: (4,6)-(4,13)) + │ ├── flags: ∅ + │ ├── requireds: (length: 0) + │ ├── optionals: (length: 0) + │ ├── rest: ∅ + │ ├── posts: (length: 0) + │ ├── keywords: (length: 1) + │ │ └── @ OptionalKeywordParameterNode (location: (4,6)-(4,13)) + │ │ ├── flags: ∅ + │ │ ├── name: :foo + │ │ ├── name_loc: (4,6)-(4,10) = "foo:" + │ │ └── value: + │ │ @ IntegerNode (location: (4,11)-(4,13)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: -1 + │ ├── keyword_rest: ∅ + │ └── block: ∅ + ├── body: ∅ + ├── locals: [:foo] + ├── def_keyword_loc: (4,0)-(4,3) = "def" + ├── operator_loc: ∅ + ├── lparen_loc: ∅ + ├── rparen_loc: ∅ + ├── equal_loc: ∅ + └── end_keyword_loc: (5,2)-(5,5) = "end" diff --git a/test/prism/snapshots/whitequark/lvar_injecting_match.txt b/test/prism/snapshots/whitequark/lvar_injecting_match.txt index d7a3015279c..644f14c01a2 100644 --- a/test/prism/snapshots/whitequark/lvar_injecting_match.txt +++ b/test/prism/snapshots/whitequark/lvar_injecting_match.txt @@ -1,44 +1,126 @@ -@ ProgramNode (location: (1,0)-(1,31)) +@ ProgramNode (location: (1,0)-(3,31)) ├── flags: ∅ -├── locals: [:match] +├── locals: [:a, :match] └── statements: - @ StatementsNode (location: (1,0)-(1,31)) + @ StatementsNode (location: (1,0)-(3,31)) ├── flags: ∅ - └── body: (length: 2) - ├── @ MatchWriteNode (location: (1,0)-(1,24)) + └── body: (length: 6) + ├── @ MatchWriteNode (location: (1,0)-(1,16)) │ ├── flags: newline │ ├── call: - │ │ @ CallNode (location: (1,0)-(1,24)) + │ │ @ CallNode (location: (1,0)-(1,16)) │ │ ├── flags: ∅ │ │ ├── receiver: - │ │ │ @ RegularExpressionNode (location: (1,0)-(1,15)) + │ │ │ @ RegularExpressionNode (location: (1,0)-(1,9)) │ │ │ ├── flags: static_literal, forced_us_ascii_encoding │ │ │ ├── opening_loc: (1,0)-(1,1) = "/" - │ │ │ ├── content_loc: (1,1)-(1,14) = "(?bar)" - │ │ │ ├── closing_loc: (1,14)-(1,15) = "/" + │ │ │ ├── content_loc: (1,1)-(1,8) = "(?a)" + │ │ │ ├── closing_loc: (1,8)-(1,9) = "/" + │ │ │ └── unescaped: "(?a)" + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :=~ + │ │ ├── message_loc: (1,10)-(1,12) = "=~" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: + │ │ │ @ ArgumentsNode (location: (1,13)-(1,16)) + │ │ │ ├── flags: ∅ + │ │ │ └── arguments: (length: 1) + │ │ │ └── @ StringNode (location: (1,13)-(1,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── opening_loc: (1,13)-(1,14) = "'" + │ │ │ ├── content_loc: (1,14)-(1,15) = "a" + │ │ │ ├── closing_loc: (1,15)-(1,16) = "'" + │ │ │ └── unescaped: "a" + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ └── targets: (length: 1) + │ └── @ LocalVariableTargetNode (location: (1,4)-(1,5)) + │ ├── flags: ∅ + │ ├── name: :a + │ └── depth: 0 + ├── @ CallNode (location: (1,18)-(1,37)) + │ ├── flags: newline + │ ├── receiver: + │ │ @ InterpolatedRegularExpressionNode (location: (1,18)-(1,30)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: (1,18)-(1,19) = "/" + │ │ ├── parts: (length: 2) + │ │ │ ├── @ EmbeddedStatementsNode (location: (1,19)-(1,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── opening_loc: (1,19)-(1,21) = "\#{" + │ │ │ │ ├── statements: ∅ + │ │ │ │ └── closing_loc: (1,21)-(1,22) = "}" + │ │ │ └── @ StringNode (location: (1,22)-(1,29)) + │ │ │ ├── flags: static_literal, frozen + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── content_loc: (1,22)-(1,29) = "(?b)" + │ │ │ ├── closing_loc: ∅ + │ │ │ └── unescaped: "(?b)" + │ │ └── closing_loc: (1,29)-(1,30) = "/" + │ ├── call_operator_loc: ∅ + │ ├── name: :=~ + │ ├── message_loc: (1,31)-(1,33) = "=~" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,34)-(1,37)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 1) + │ │ └── @ StringNode (location: (1,34)-(1,37)) + │ │ ├── flags: ∅ + │ │ ├── opening_loc: (1,34)-(1,35) = "'" + │ │ ├── content_loc: (1,35)-(1,36) = "b" + │ │ ├── closing_loc: (1,36)-(1,37) = "'" + │ │ └── unescaped: "b" + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── @ LocalVariableReadNode (location: (1,39)-(1,40)) + │ ├── flags: newline + │ ├── name: :a + │ └── depth: 0 + ├── @ CallNode (location: (1,42)-(1,43)) + │ ├── flags: newline, variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :b + │ ├── message_loc: (1,42)-(1,43) = "b" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── @ MatchWriteNode (location: (3,0)-(3,24)) + │ ├── flags: newline + │ ├── call: + │ │ @ CallNode (location: (3,0)-(3,24)) + │ │ ├── flags: ∅ + │ │ ├── receiver: + │ │ │ @ RegularExpressionNode (location: (3,0)-(3,15)) + │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ ├── opening_loc: (3,0)-(3,1) = "/" + │ │ │ ├── content_loc: (3,1)-(3,14) = "(?bar)" + │ │ │ ├── closing_loc: (3,14)-(3,15) = "/" │ │ │ └── unescaped: "(?bar)" │ │ ├── call_operator_loc: ∅ │ │ ├── name: :=~ - │ │ ├── message_loc: (1,16)-(1,18) = "=~" + │ │ ├── message_loc: (3,16)-(3,18) = "=~" │ │ ├── opening_loc: ∅ │ │ ├── arguments: - │ │ │ @ ArgumentsNode (location: (1,19)-(1,24)) + │ │ │ @ ArgumentsNode (location: (3,19)-(3,24)) │ │ │ ├── flags: ∅ │ │ │ └── arguments: (length: 1) - │ │ │ └── @ StringNode (location: (1,19)-(1,24)) + │ │ │ └── @ StringNode (location: (3,19)-(3,24)) │ │ │ ├── flags: ∅ - │ │ │ ├── opening_loc: (1,19)-(1,20) = "'" - │ │ │ ├── content_loc: (1,20)-(1,23) = "bar" - │ │ │ ├── closing_loc: (1,23)-(1,24) = "'" + │ │ │ ├── opening_loc: (3,19)-(3,20) = "'" + │ │ │ ├── content_loc: (3,20)-(3,23) = "bar" + │ │ │ ├── closing_loc: (3,23)-(3,24) = "'" │ │ │ └── unescaped: "bar" │ │ ├── closing_loc: ∅ │ │ └── block: ∅ │ └── targets: (length: 1) - │ └── @ LocalVariableTargetNode (location: (1,4)-(1,9)) + │ └── @ LocalVariableTargetNode (location: (3,4)-(3,9)) │ ├── flags: ∅ │ ├── name: :match │ └── depth: 0 - └── @ LocalVariableReadNode (location: (1,26)-(1,31)) + └── @ LocalVariableReadNode (location: (3,26)-(3,31)) ├── flags: newline ├── name: :match └── depth: 0 diff --git a/test/prism/snapshots/whitequark/marg_combinations.txt b/test/prism/snapshots/whitequark/marg_combinations.txt new file mode 100644 index 00000000000..0083ef540eb --- /dev/null +++ b/test/prism/snapshots/whitequark/marg_combinations.txt @@ -0,0 +1,391 @@ +@ ProgramNode (location: (1,0)-(19,20)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(19,20)) + ├── flags: ∅ + └── body: (length: 10) + ├── @ DefNode (location: (1,0)-(1,18)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (1,4)-(1,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,7)-(1,12)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (1,7)-(1,12)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 1) + │ │ │ │ └── @ MultiTargetNode (location: (1,8)-(1,11)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── lefts: (length: 1) + │ │ │ │ │ └── @ RequiredParameterNode (location: (1,9)-(1,10)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── name: :a + │ │ │ │ ├── rest: ∅ + │ │ │ │ ├── rights: (length: 0) + │ │ │ │ ├── lparen_loc: (1,8)-(1,9) = "(" + │ │ │ │ └── rparen_loc: (1,10)-(1,11) = ")" + │ │ │ ├── rest: ∅ + │ │ │ ├── rights: (length: 0) + │ │ │ ├── lparen_loc: (1,7)-(1,8) = "(" + │ │ │ └── rparen_loc: (1,11)-(1,12) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a] + │ ├── def_keyword_loc: (1,0)-(1,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (1,6)-(1,7) = "(" + │ ├── rparen_loc: (1,12)-(1,13) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (1,15)-(1,18) = "end" + ├── @ DefNode (location: (3,0)-(3,16)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (3,4)-(3,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (3,7)-(3,10)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (3,7)-(3,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (3,8)-(3,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (3,8)-(3,9) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── rights: (length: 0) + │ │ │ ├── lparen_loc: (3,7)-(3,8) = "(" + │ │ │ └── rparen_loc: (3,9)-(3,10) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [] + │ ├── def_keyword_loc: (3,0)-(3,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (3,6)-(3,7) = "(" + │ ├── rparen_loc: (3,10)-(3,11) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (3,13)-(3,16) = "end" + ├── @ DefNode (location: (5,0)-(5,19)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (5,4)-(5,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (5,7)-(5,13)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (5,7)-(5,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (5,8)-(5,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (5,8)-(5,9) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── rights: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (5,11)-(5,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── lparen_loc: (5,7)-(5,8) = "(" + │ │ │ └── rparen_loc: (5,12)-(5,13) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:p] + │ ├── def_keyword_loc: (5,0)-(5,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (5,6)-(5,7) = "(" + │ ├── rparen_loc: (5,13)-(5,14) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (5,16)-(5,19) = "end" + ├── @ DefNode (location: (7,0)-(7,17)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (7,4)-(7,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (7,7)-(7,11)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (7,7)-(7,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (7,8)-(7,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (7,8)-(7,9) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ RequiredParameterNode (location: (7,9)-(7,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :r + │ │ │ ├── rights: (length: 0) + │ │ │ ├── lparen_loc: (7,7)-(7,8) = "(" + │ │ │ └── rparen_loc: (7,10)-(7,11) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:r] + │ ├── def_keyword_loc: (7,0)-(7,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (7,6)-(7,7) = "(" + │ ├── rparen_loc: (7,11)-(7,12) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (7,14)-(7,17) = "end" + ├── @ DefNode (location: (9,0)-(9,20)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (9,4)-(9,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (9,7)-(9,14)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (9,7)-(9,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (9,8)-(9,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (9,8)-(9,9) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ RequiredParameterNode (location: (9,9)-(9,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :r + │ │ │ ├── rights: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (9,12)-(9,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── lparen_loc: (9,7)-(9,8) = "(" + │ │ │ └── rparen_loc: (9,13)-(9,14) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:r, :p] + │ ├── def_keyword_loc: (9,0)-(9,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (9,6)-(9,7) = "(" + │ ├── rparen_loc: (9,14)-(9,15) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (9,17)-(9,20) = "end" + ├── @ DefNode (location: (11,0)-(11,19)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (11,4)-(11,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (11,7)-(11,13)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (11,7)-(11,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (11,8)-(11,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (11,11)-(11,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (11,11)-(11,12) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── rights: (length: 0) + │ │ │ ├── lparen_loc: (11,7)-(11,8) = "(" + │ │ │ └── rparen_loc: (11,12)-(11,13) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a] + │ ├── def_keyword_loc: (11,0)-(11,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (11,6)-(11,7) = "(" + │ ├── rparen_loc: (11,13)-(11,14) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (11,16)-(11,19) = "end" + ├── @ DefNode (location: (13,0)-(13,22)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (13,4)-(13,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (13,7)-(13,16)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (13,7)-(13,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (13,8)-(13,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (13,11)-(13,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (13,11)-(13,12) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── rights: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (13,14)-(13,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── lparen_loc: (13,7)-(13,8) = "(" + │ │ │ └── rparen_loc: (13,15)-(13,16) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a, :p] + │ ├── def_keyword_loc: (13,0)-(13,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (13,6)-(13,7) = "(" + │ ├── rparen_loc: (13,16)-(13,17) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (13,19)-(13,22) = "end" + ├── @ DefNode (location: (15,0)-(15,20)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (15,4)-(15,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (15,7)-(15,14)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (15,7)-(15,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (15,8)-(15,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (15,11)-(15,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (15,11)-(15,12) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ RequiredParameterNode (location: (15,12)-(15,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :r + │ │ │ ├── rights: (length: 0) + │ │ │ ├── lparen_loc: (15,7)-(15,8) = "(" + │ │ │ └── rparen_loc: (15,13)-(15,14) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a, :r] + │ ├── def_keyword_loc: (15,0)-(15,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (15,6)-(15,7) = "(" + │ ├── rparen_loc: (15,14)-(15,15) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (15,17)-(15,20) = "end" + ├── @ DefNode (location: (17,0)-(17,23)) + │ ├── flags: newline + │ ├── name: :f + │ ├── name_loc: (17,4)-(17,5) = "f" + │ ├── receiver: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (17,7)-(17,17)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ MultiTargetNode (location: (17,7)-(17,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── lefts: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (17,8)-(17,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (17,11)-(17,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (17,11)-(17,12) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ RequiredParameterNode (location: (17,12)-(17,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :r + │ │ │ ├── rights: (length: 1) + │ │ │ │ └── @ RequiredParameterNode (location: (17,15)-(17,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :p + │ │ │ ├── lparen_loc: (17,7)-(17,8) = "(" + │ │ │ └── rparen_loc: (17,16)-(17,17) = ")" + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── body: ∅ + │ ├── locals: [:a, :r, :p] + │ ├── def_keyword_loc: (17,0)-(17,3) = "def" + │ ├── operator_loc: ∅ + │ ├── lparen_loc: (17,6)-(17,7) = "(" + │ ├── rparen_loc: (17,17)-(17,18) = ")" + │ ├── equal_loc: ∅ + │ └── end_keyword_loc: (17,20)-(17,23) = "end" + └── @ DefNode (location: (19,0)-(19,20)) + ├── flags: newline + ├── name: :f + ├── name_loc: (19,4)-(19,5) = "f" + ├── receiver: ∅ + ├── parameters: + │ @ ParametersNode (location: (19,7)-(19,14)) + │ ├── flags: ∅ + │ ├── requireds: (length: 1) + │ │ └── @ MultiTargetNode (location: (19,7)-(19,14)) + │ │ ├── flags: ∅ + │ │ ├── lefts: (length: 2) + │ │ │ ├── @ RequiredParameterNode (location: (19,8)-(19,9)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ └── @ RequiredParameterNode (location: (19,11)-(19,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a1 + │ │ ├── rest: ∅ + │ │ ├── rights: (length: 0) + │ │ ├── lparen_loc: (19,7)-(19,8) = "(" + │ │ └── rparen_loc: (19,13)-(19,14) = ")" + │ ├── optionals: (length: 0) + │ ├── rest: ∅ + │ ├── posts: (length: 0) + │ ├── keywords: (length: 0) + │ ├── keyword_rest: ∅ + │ └── block: ∅ + ├── body: ∅ + ├── locals: [:a, :a1] + ├── def_keyword_loc: (19,0)-(19,3) = "def" + ├── operator_loc: ∅ + ├── lparen_loc: (19,6)-(19,7) = "(" + ├── rparen_loc: (19,14)-(19,15) = ")" + ├── equal_loc: ∅ + └── end_keyword_loc: (19,17)-(19,20) = "end" diff --git a/test/prism/snapshots/whitequark/multiple_args_with_trailing_comma.txt b/test/prism/snapshots/whitequark/multiple_args_with_trailing_comma.txt new file mode 100644 index 00000000000..9fd60b2a3c1 --- /dev/null +++ b/test/prism/snapshots/whitequark/multiple_args_with_trailing_comma.txt @@ -0,0 +1,47 @@ +@ ProgramNode (location: (1,0)-(1,12)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,12)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,12)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :f + ├── message_loc: (1,0)-(1,1) = "f" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,1)-(1,12)) + ├── flags: ∅ + ├── locals: [:a, :b] + ├── parameters: + │ @ BlockParametersNode (location: (1,3)-(1,10)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,4)-(1,9)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 2) + │ │ │ ├── @ RequiredParameterNode (location: (1,4)-(1,5)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :a + │ │ │ └── @ RequiredParameterNode (location: (1,7)-(1,8)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :b + │ │ ├── optionals: (length: 0) + │ │ ├── rest: + │ │ │ @ ImplicitRestNode (location: (1,8)-(1,9)) + │ │ │ └── flags: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (1,3)-(1,4) = "|" + │ └── closing_loc: (1,9)-(1,10) = "|" + ├── body: ∅ + ├── opening_loc: (1,1)-(1,2) = "{" + └── closing_loc: (1,11)-(1,12) = "}" diff --git a/test/prism/snapshots/whitequark/pattern_matching_const_pattern.txt b/test/prism/snapshots/whitequark/pattern_matching_const_pattern.txt new file mode 100644 index 00000000000..55a851073f2 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_const_pattern.txt @@ -0,0 +1,287 @@ +@ ProgramNode (location: (1,0)-(11,33)) +├── flags: ∅ +├── locals: [:x] +└── statements: + @ StatementsNode (location: (1,0)-(11,33)) + ├── flags: ∅ + └── body: (length: 6) + ├── @ CaseMatchNode (location: (1,0)-(1,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (1,13)-(1,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (1,13)-(1,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :A + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (1,14)-(1,15) = "(" + │ │ │ └── closing_loc: (1,15)-(1,16) = ")" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,22)-(1,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (1,22)-(1,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: (1,17)-(1,21) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,28)-(1,31) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,35)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,30)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (3,13)-(3,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (3,13)-(3,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :A + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ IntegerNode (location: (3,15)-(3,16)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── @ IntegerNode (location: (3,18)-(3,19)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (3,14)-(3,15) = "(" + │ │ │ └── closing_loc: (3,19)-(3,20) = ")" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,26)-(3,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (3,26)-(3,30)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,21)-(3,25) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,32)-(3,35) = "end" + ├── @ CaseMatchNode (location: (5,0)-(5,33)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (5,5)-(5,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (5,5)-(5,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (5,10)-(5,28)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (5,13)-(5,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (5,13)-(5,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :A + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (5,15)-(5,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (5,15)-(5,17)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (5,15)-(5,16) = "x" + │ │ │ │ │ ├── closing_loc: (5,16)-(5,17) = ":" + │ │ │ │ │ └── unescaped: "x" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (5,15)-(5,16)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (5,15)-(5,16)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (5,14)-(5,15) = "(" + │ │ │ └── closing_loc: (5,17)-(5,18) = ")" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,24)-(5,28)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (5,24)-(5,28)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (5,10)-(5,12) = "in" + │ │ └── then_loc: (5,19)-(5,23) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (5,0)-(5,4) = "case" + │ └── end_keyword_loc: (5,30)-(5,33) = "end" + ├── @ CaseMatchNode (location: (7,0)-(7,35)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (7,5)-(7,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (7,5)-(7,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (7,10)-(7,30)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (7,13)-(7,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (7,13)-(7,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :A + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ IntegerNode (location: (7,15)-(7,16)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── @ IntegerNode (location: (7,18)-(7,19)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (7,14)-(7,15) = "[" + │ │ │ └── closing_loc: (7,19)-(7,20) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (7,26)-(7,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (7,26)-(7,30)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (7,10)-(7,12) = "in" + │ │ └── then_loc: (7,21)-(7,25) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (7,0)-(7,4) = "case" + │ └── end_keyword_loc: (7,32)-(7,35) = "end" + ├── @ CaseMatchNode (location: (9,0)-(9,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (9,5)-(9,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (9,5)-(9,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (9,10)-(9,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (9,13)-(9,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: + │ │ │ │ @ ConstantReadNode (location: (9,13)-(9,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :A + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (9,14)-(9,15) = "[" + │ │ │ └── closing_loc: (9,15)-(9,16) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (9,22)-(9,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (9,22)-(9,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (9,10)-(9,12) = "in" + │ │ └── then_loc: (9,17)-(9,21) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (9,0)-(9,4) = "case" + │ └── end_keyword_loc: (9,28)-(9,31) = "end" + └── @ CaseMatchNode (location: (11,0)-(11,33)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (11,5)-(11,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (11,5)-(11,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (11,10)-(11,28)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ HashPatternNode (location: (11,13)-(11,18)) + │ │ ├── flags: ∅ + │ │ ├── constant: + │ │ │ @ ConstantReadNode (location: (11,13)-(11,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :A + │ │ ├── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (11,15)-(11,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ SymbolNode (location: (11,15)-(11,17)) + │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── value_loc: (11,15)-(11,16) = "x" + │ │ │ │ ├── closing_loc: (11,16)-(11,17) = ":" + │ │ │ │ └── unescaped: "x" + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (11,15)-(11,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (11,15)-(11,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ └── operator_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── opening_loc: (11,14)-(11,15) = "[" + │ │ └── closing_loc: (11,17)-(11,18) = "]" + │ ├── statements: + │ │ @ StatementsNode (location: (11,24)-(11,28)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (11,24)-(11,28)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (11,10)-(11,12) = "in" + │ └── then_loc: (11,19)-(11,23) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (11,0)-(11,4) = "case" + └── end_keyword_loc: (11,30)-(11,33) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_constants.txt b/test/prism/snapshots/whitequark/pattern_matching_constants.txt new file mode 100644 index 00000000000..8a05a70f802 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_constants.txt @@ -0,0 +1,109 @@ +@ ProgramNode (location: (1,0)-(5,32)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(5,32)) + ├── flags: ∅ + └── body: (length: 3) + ├── @ CaseMatchNode (location: (1,0)-(1,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ConstantPathNode (location: (1,13)-(1,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── parent: ∅ + │ │ │ ├── name: :A + │ │ │ ├── delimiter_loc: (1,13)-(1,15) = "::" + │ │ │ └── name_loc: (1,15)-(1,16) = "A" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,22)-(1,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (1,22)-(1,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: (1,17)-(1,21) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,28)-(1,31) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,29)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,24)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ConstantReadNode (location: (3,13)-(3,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :A + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,20)-(3,24)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (3,20)-(3,24)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,15)-(3,19) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,26)-(3,29) = "end" + └── @ CaseMatchNode (location: (5,0)-(5,32)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (5,5)-(5,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (5,5)-(5,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (5,10)-(5,27)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ ConstantPathNode (location: (5,13)-(5,17)) + │ │ ├── flags: ∅ + │ │ ├── parent: + │ │ │ @ ConstantReadNode (location: (5,13)-(5,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :A + │ │ ├── name: :B + │ │ ├── delimiter_loc: (5,14)-(5,16) = "::" + │ │ └── name_loc: (5,16)-(5,17) = "B" + │ ├── statements: + │ │ @ StatementsNode (location: (5,23)-(5,27)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (5,23)-(5,27)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (5,10)-(5,12) = "in" + │ └── then_loc: (5,18)-(5,22) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (5,0)-(5,4) = "case" + └── end_keyword_loc: (5,29)-(5,32) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_explicit_array_match.txt b/test/prism/snapshots/whitequark/pattern_matching_explicit_array_match.txt new file mode 100644 index 00000000000..3a1eac348ab --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_explicit_array_match.txt @@ -0,0 +1,471 @@ +@ ProgramNode (location: (1,0)-(19,30)) +├── flags: ∅ +├── locals: [:x, :y, :z] +└── statements: + @ StatementsNode (location: (1,0)-(19,30)) + ├── flags: ∅ + └── body: (length: 10) + ├── @ CaseMatchNode (location: (1,0)-(1,34)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,29)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (1,13)-(1,19)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (1,14)-(1,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (1,14)-(1,15) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (1,17)-(1,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── opening_loc: (1,13)-(1,14) = "[" + │ │ │ └── closing_loc: (1,18)-(1,19) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,25)-(1,29)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (1,25)-(1,29)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: (1,20)-(1,24) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,31)-(1,34) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,35)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,30)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (3,13)-(3,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (3,14)-(3,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (3,14)-(3,15) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ LocalVariableTargetNode (location: (3,15)-(3,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (3,18)-(3,19)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── opening_loc: (3,13)-(3,14) = "[" + │ │ │ └── closing_loc: (3,19)-(3,20) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,26)-(3,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (3,26)-(3,30)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,21)-(3,25) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,32)-(3,35) = "end" + ├── @ CaseMatchNode (location: (5,0)-(5,37)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (5,5)-(5,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (5,5)-(5,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (5,10)-(5,32)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (5,13)-(5,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (5,14)-(5,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (5,17)-(5,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (5,17)-(5,18) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (5,20)-(5,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── opening_loc: (5,13)-(5,14) = "[" + │ │ │ └── closing_loc: (5,21)-(5,22) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,28)-(5,32)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (5,28)-(5,32)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (5,10)-(5,12) = "in" + │ │ └── then_loc: (5,23)-(5,27) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (5,0)-(5,4) = "case" + │ └── end_keyword_loc: (5,34)-(5,37) = "end" + ├── @ CaseMatchNode (location: (7,0)-(7,38)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (7,5)-(7,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (7,5)-(7,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (7,10)-(7,33)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (7,13)-(7,23)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (7,14)-(7,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (7,17)-(7,19)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (7,17)-(7,18) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ LocalVariableTargetNode (location: (7,18)-(7,19)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (7,21)-(7,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :z + │ │ │ │ └── depth: 0 + │ │ │ ├── opening_loc: (7,13)-(7,14) = "[" + │ │ │ └── closing_loc: (7,22)-(7,23) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (7,29)-(7,33)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (7,29)-(7,33)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (7,10)-(7,12) = "in" + │ │ └── then_loc: (7,24)-(7,28) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (7,0)-(7,4) = "case" + │ └── end_keyword_loc: (7,35)-(7,38) = "end" + ├── @ CaseMatchNode (location: (9,0)-(9,37)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (9,5)-(9,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (9,5)-(9,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (9,10)-(9,32)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (9,13)-(9,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ LocalVariableTargetNode (location: (9,14)-(9,15)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── @ LocalVariableTargetNode (location: (9,17)-(9,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (9,20)-(9,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (9,20)-(9,21) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (9,13)-(9,14) = "[" + │ │ │ └── closing_loc: (9,21)-(9,22) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (9,28)-(9,32)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (9,28)-(9,32)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (9,10)-(9,12) = "in" + │ │ └── then_loc: (9,23)-(9,27) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (9,0)-(9,4) = "case" + │ └── end_keyword_loc: (9,34)-(9,37) = "end" + ├── @ CaseMatchNode (location: (11,0)-(11,38)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (11,5)-(11,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (11,5)-(11,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (11,10)-(11,33)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (11,13)-(11,23)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ LocalVariableTargetNode (location: (11,14)-(11,15)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── @ LocalVariableTargetNode (location: (11,17)-(11,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (11,20)-(11,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (11,20)-(11,21) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ LocalVariableTargetNode (location: (11,21)-(11,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :z + │ │ │ │ └── depth: 0 + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (11,13)-(11,14) = "[" + │ │ │ └── closing_loc: (11,22)-(11,23) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (11,29)-(11,33)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (11,29)-(11,33)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (11,10)-(11,12) = "in" + │ │ └── then_loc: (11,24)-(11,28) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (11,0)-(11,4) = "case" + │ └── end_keyword_loc: (11,35)-(11,38) = "end" + ├── @ CaseMatchNode (location: (13,0)-(13,35)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (13,5)-(13,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (13,5)-(13,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (13,10)-(13,30)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (13,13)-(13,20)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ LocalVariableTargetNode (location: (13,14)-(13,15)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── @ LocalVariableTargetNode (location: (13,17)-(13,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ ImplicitRestNode (location: (13,18)-(13,19)) + │ │ │ │ └── flags: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (13,13)-(13,14) = "[" + │ │ │ └── closing_loc: (13,19)-(13,20) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (13,26)-(13,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (13,26)-(13,30)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (13,10)-(13,12) = "in" + │ │ └── then_loc: (13,21)-(13,25) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (13,0)-(13,4) = "case" + │ └── end_keyword_loc: (13,32)-(13,35) = "end" + ├── @ CaseMatchNode (location: (15,0)-(15,34)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (15,5)-(15,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (15,5)-(15,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (15,10)-(15,29)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (15,13)-(15,19)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ LocalVariableTargetNode (location: (15,14)-(15,15)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── @ LocalVariableTargetNode (location: (15,17)-(15,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (15,13)-(15,14) = "[" + │ │ │ └── closing_loc: (15,18)-(15,19) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (15,25)-(15,29)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (15,25)-(15,29)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (15,10)-(15,12) = "in" + │ │ └── then_loc: (15,20)-(15,24) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (15,0)-(15,4) = "case" + │ └── end_keyword_loc: (15,31)-(15,34) = "end" + ├── @ CaseMatchNode (location: (17,0)-(17,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (17,5)-(17,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (17,5)-(17,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (17,10)-(17,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (17,13)-(17,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (17,14)-(17,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ ImplicitRestNode (location: (17,15)-(17,16)) + │ │ │ │ └── flags: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: (17,13)-(17,14) = "[" + │ │ │ └── closing_loc: (17,16)-(17,17) = "]" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (17,23)-(17,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (17,23)-(17,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (17,10)-(17,12) = "in" + │ │ └── then_loc: (17,18)-(17,22) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (17,0)-(17,4) = "case" + │ └── end_keyword_loc: (17,28)-(17,31) = "end" + └── @ CaseMatchNode (location: (19,0)-(19,30)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (19,5)-(19,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (19,5)-(19,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (19,10)-(19,25)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ ArrayPatternNode (location: (19,13)-(19,16)) + │ │ ├── flags: ∅ + │ │ ├── constant: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ LocalVariableTargetNode (location: (19,14)-(19,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :x + │ │ │ └── depth: 0 + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── opening_loc: (19,13)-(19,14) = "[" + │ │ └── closing_loc: (19,15)-(19,16) = "]" + │ ├── statements: + │ │ @ StatementsNode (location: (19,22)-(19,25)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ NilNode (location: (19,22)-(19,25)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (19,10)-(19,12) = "in" + │ └── then_loc: (19,17)-(19,21) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (19,0)-(19,4) = "case" + └── end_keyword_loc: (19,27)-(19,30) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_expr_in_paren.txt b/test/prism/snapshots/whitequark/pattern_matching_expr_in_paren.txt new file mode 100644 index 00000000000..5be35266498 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_expr_in_paren.txt @@ -0,0 +1,43 @@ +@ ProgramNode (location: (1,0)-(1,31)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,31)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,31)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,26)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ ParenthesesNode (location: (1,13)-(1,16)) + │ │ ├── flags: ∅ + │ │ ├── body: + │ │ │ @ IntegerNode (location: (1,14)-(1,15)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── opening_loc: (1,13)-(1,14) = "(" + │ │ └── closing_loc: (1,15)-(1,16) = ")" + │ ├── statements: + │ │ @ StatementsNode (location: (1,22)-(1,26)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (1,22)-(1,26)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,17)-(1,21) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,28)-(1,31) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_hash.txt b/test/prism/snapshots/whitequark/pattern_matching_hash.txt new file mode 100644 index 00000000000..c433b66a7bb --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_hash.txt @@ -0,0 +1,833 @@ +@ ProgramNode (location: (1,0)-(48,30)) +├── flags: ∅ +├── locals: [:b, :c, :a, :_a] +└── statements: + @ StatementsNode (location: (1,0)-(48,30)) + ├── flags: ∅ + └── body: (length: 15) + ├── @ CaseMatchNode (location: (1,0)-(4,11)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (2,8)-(3,13)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (2,11)-(2,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 2) + │ │ │ │ ├── @ AssocNode (location: (2,11)-(2,18)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── key: + │ │ │ │ │ │ @ SymbolNode (location: (2,11)-(2,13)) + │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ ├── value_loc: (2,11)-(2,12) = "a" + │ │ │ │ │ │ ├── closing_loc: (2,12)-(2,13) = ":" + │ │ │ │ │ │ └── unescaped: "a" + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ HashPatternNode (location: (2,14)-(2,18)) + │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ ├── constant: ∅ + │ │ │ │ │ │ ├── elements: (length: 1) + │ │ │ │ │ │ │ └── @ AssocNode (location: (2,15)-(2,17)) + │ │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ │ ├── key: + │ │ │ │ │ │ │ │ @ SymbolNode (location: (2,15)-(2,17)) + │ │ │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ │ │ ├── value_loc: (2,15)-(2,16) = "b" + │ │ │ │ │ │ │ │ ├── closing_loc: (2,16)-(2,17) = ":" + │ │ │ │ │ │ │ │ └── unescaped: "b" + │ │ │ │ │ │ │ ├── value: + │ │ │ │ │ │ │ │ @ ImplicitNode (location: (2,15)-(2,16)) + │ │ │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ │ │ └── value: + │ │ │ │ │ │ │ │ @ LocalVariableTargetNode (location: (2,15)-(2,16)) + │ │ │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ │ │ ├── name: :b + │ │ │ │ │ │ │ │ └── depth: 0 + │ │ │ │ │ │ │ └── operator_loc: ∅ + │ │ │ │ │ │ ├── rest: ∅ + │ │ │ │ │ │ ├── opening_loc: (2,14)-(2,15) = "{" + │ │ │ │ │ │ └── closing_loc: (2,17)-(2,18) = "}" + │ │ │ │ │ └── operator_loc: ∅ + │ │ │ │ └── @ AssocNode (location: (2,20)-(2,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (2,20)-(2,22)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (2,20)-(2,21) = "c" + │ │ │ │ │ ├── closing_loc: (2,21)-(2,22) = ":" + │ │ │ │ │ └── unescaped: "c" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (2,20)-(2,21)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (2,20)-(2,21)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :c + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,10)-(3,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ CallNode (location: (3,10)-(3,13)) + │ │ │ ├── flags: newline, ignore_visibility + │ │ │ ├── receiver: ∅ + │ │ │ ├── call_operator_loc: ∅ + │ │ │ ├── name: :p + │ │ │ ├── message_loc: (3,10)-(3,11) = "p" + │ │ │ ├── opening_loc: ∅ + │ │ │ ├── arguments: + │ │ │ │ @ ArgumentsNode (location: (3,12)-(3,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── arguments: (length: 1) + │ │ │ │ └── @ LocalVariableReadNode (location: (3,12)-(3,13)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :c + │ │ │ │ └── depth: 0 + │ │ │ ├── closing_loc: ∅ + │ │ │ └── block: ∅ + │ │ ├── in_loc: (2,8)-(2,10) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (4,8)-(4,11) = "end" + ├── @ CaseMatchNode (location: (6,0)-(10,11)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (6,5)-(6,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (6,5)-(6,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (7,8)-(9,15)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (7,11)-(8,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (7,12)-(7,19)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (7,12)-(7,16)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (7,12)-(7,15) = "Foo" + │ │ │ │ │ ├── closing_loc: (7,15)-(7,16) = ":" + │ │ │ │ │ └── unescaped: "Foo" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (7,17)-(7,19)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 42 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (7,11)-(7,12) = "{" + │ │ │ └── closing_loc: (8,8)-(8,9) = "}" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (9,10)-(9,15)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ FalseNode (location: (9,10)-(9,15)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (7,8)-(7,10) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (6,0)-(6,4) = "case" + │ └── end_keyword_loc: (10,8)-(10,11) = "end" + ├── @ CaseMatchNode (location: (12,0)-(16,11)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (12,5)-(12,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (12,5)-(12,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (13,8)-(15,15)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (13,11)-(14,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (13,12)-(14,15)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (13,12)-(13,14)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (13,12)-(13,13) = "a" + │ │ │ │ │ ├── closing_loc: (13,13)-(13,14) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (14,14)-(14,15)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 2 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (13,11)-(13,12) = "{" + │ │ │ └── closing_loc: (14,15)-(14,16) = "}" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (15,10)-(15,15)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ FalseNode (location: (15,10)-(15,15)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (13,8)-(13,10) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (12,0)-(12,4) = "case" + │ └── end_keyword_loc: (16,8)-(16,11) = "end" + ├── @ CaseMatchNode (location: (18,0)-(22,11)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (18,5)-(18,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (18,5)-(18,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (19,8)-(21,14)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (19,11)-(20,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (19,12)-(19,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (19,12)-(19,14)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (19,12)-(19,13) = "a" + │ │ │ │ │ ├── closing_loc: (19,13)-(19,14) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (19,12)-(19,13)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (19,12)-(19,13)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :a + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (19,11)-(19,12) = "{" + │ │ │ └── closing_loc: (20,8)-(20,9) = "}" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (21,10)-(21,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (21,10)-(21,14)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (19,8)-(19,10) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (18,0)-(18,4) = "case" + │ └── end_keyword_loc: (22,8)-(22,11) = "end" + ├── @ CaseMatchNode (location: (24,0)-(28,11)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (24,5)-(24,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (24,5)-(24,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (25,8)-(27,15)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (25,11)-(26,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (25,12)-(25,16)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (25,12)-(25,14)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (25,12)-(25,13) = "a" + │ │ │ │ │ ├── closing_loc: (25,13)-(25,14) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (25,15)-(25,16)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (25,11)-(25,12) = "{" + │ │ │ └── closing_loc: (26,8)-(26,9) = "}" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (27,10)-(27,15)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ FalseNode (location: (27,10)-(27,15)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (25,8)-(25,10) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (24,0)-(24,4) = "case" + │ └── end_keyword_loc: (28,8)-(28,11) = "end" + ├── @ CaseMatchNode (location: (30,0)-(30,30)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (30,5)-(30,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (30,5)-(30,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (30,10)-(30,25)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (30,13)-(30,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ AssocSplatNode (location: (30,13)-(30,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── value: ∅ + │ │ │ │ └── operator_loc: (30,13)-(30,15) = "**" + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (30,21)-(30,25)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (30,21)-(30,25)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (30,10)-(30,12) = "in" + │ │ └── then_loc: (30,16)-(30,20) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (30,0)-(30,4) = "case" + │ └── end_keyword_loc: (30,27)-(30,30) = "end" + ├── @ CaseMatchNode (location: (32,0)-(32,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (32,5)-(32,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (32,5)-(32,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (32,10)-(32,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (32,13)-(32,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ AssocSplatNode (location: (32,13)-(32,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (32,15)-(32,16)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :a + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: (32,13)-(32,15) = "**" + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (32,22)-(32,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (32,22)-(32,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (32,10)-(32,12) = "in" + │ │ └── then_loc: (32,17)-(32,21) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (32,0)-(32,4) = "case" + │ └── end_keyword_loc: (32,28)-(32,31) = "end" + ├── @ CaseMatchNode (location: (34,0)-(34,32)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (34,5)-(34,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (34,5)-(34,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (34,10)-(34,27)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (34,13)-(34,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (34,13)-(34,17)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (34,13)-(34,15)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (34,13)-(34,14) = "a" + │ │ │ │ │ ├── closing_loc: (34,14)-(34,15) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (34,16)-(34,17)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (34,23)-(34,27)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (34,23)-(34,27)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (34,10)-(34,12) = "in" + │ │ └── then_loc: (34,18)-(34,22) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (34,0)-(34,4) = "case" + │ └── end_keyword_loc: (34,29)-(34,32) = "end" + ├── @ CaseMatchNode (location: (36,0)-(36,41)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (36,5)-(36,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (36,5)-(36,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (36,10)-(36,36)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (36,13)-(36,26)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 2) + │ │ │ │ ├── @ AssocNode (location: (36,13)-(36,17)) + │ │ │ │ │ ├── flags: static_literal + │ │ │ │ │ ├── key: + │ │ │ │ │ │ @ SymbolNode (location: (36,13)-(36,15)) + │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ ├── value_loc: (36,13)-(36,14) = "a" + │ │ │ │ │ │ ├── closing_loc: (36,14)-(36,15) = ":" + │ │ │ │ │ │ └── unescaped: "a" + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ IntegerNode (location: (36,16)-(36,17)) + │ │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ │ └── value: 1 + │ │ │ │ │ └── operator_loc: ∅ + │ │ │ │ └── @ AssocNode (location: (36,19)-(36,22)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (36,19)-(36,22)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (36,19)-(36,21) = "_a" + │ │ │ │ │ ├── closing_loc: (36,21)-(36,22) = ":" + │ │ │ │ │ └── unescaped: "_a" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (36,19)-(36,21)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (36,19)-(36,21)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :_a + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: + │ │ │ │ @ AssocSplatNode (location: (36,24)-(36,26)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── value: ∅ + │ │ │ │ └── operator_loc: (36,24)-(36,26) = "**" + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (36,32)-(36,36)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (36,32)-(36,36)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (36,10)-(36,12) = "in" + │ │ └── then_loc: (36,27)-(36,31) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (36,0)-(36,4) = "case" + │ └── end_keyword_loc: (36,38)-(36,41) = "end" + ├── @ CaseMatchNode (location: (38,0)-(38,38)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (38,5)-(38,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (38,5)-(38,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (38,10)-(38,33)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (38,13)-(38,23)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 2) + │ │ │ │ ├── @ AssocNode (location: (38,13)-(38,17)) + │ │ │ │ │ ├── flags: static_literal + │ │ │ │ │ ├── key: + │ │ │ │ │ │ @ SymbolNode (location: (38,13)-(38,15)) + │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ ├── value_loc: (38,13)-(38,14) = "a" + │ │ │ │ │ │ ├── closing_loc: (38,14)-(38,15) = ":" + │ │ │ │ │ │ └── unescaped: "a" + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ IntegerNode (location: (38,16)-(38,17)) + │ │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ │ └── value: 1 + │ │ │ │ │ └── operator_loc: ∅ + │ │ │ │ └── @ AssocNode (location: (38,19)-(38,23)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (38,19)-(38,21)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (38,19)-(38,20) = "b" + │ │ │ │ │ ├── closing_loc: (38,20)-(38,21) = ":" + │ │ │ │ │ └── unescaped: "b" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (38,22)-(38,23)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 2 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (38,29)-(38,33)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (38,29)-(38,33)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (38,10)-(38,12) = "in" + │ │ └── then_loc: (38,24)-(38,28) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (38,0)-(38,4) = "case" + │ └── end_keyword_loc: (38,35)-(38,38) = "end" + ├── @ CaseMatchNode (location: (40,0)-(40,30)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (40,5)-(40,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (40,5)-(40,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (40,10)-(40,25)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (40,13)-(40,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (40,13)-(40,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (40,13)-(40,15)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (40,13)-(40,14) = "a" + │ │ │ │ │ ├── closing_loc: (40,14)-(40,15) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (40,13)-(40,14)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (40,13)-(40,14)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :a + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (40,21)-(40,25)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (40,21)-(40,25)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (40,10)-(40,12) = "in" + │ │ └── then_loc: (40,16)-(40,20) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (40,0)-(40,4) = "case" + │ └── end_keyword_loc: (40,27)-(40,30) = "end" + ├── @ CaseMatchNode (location: (42,0)-(42,34)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (42,5)-(42,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (42,5)-(42,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (42,10)-(42,29)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (42,13)-(42,19)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 2) + │ │ │ │ ├── @ AssocNode (location: (42,13)-(42,15)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── key: + │ │ │ │ │ │ @ SymbolNode (location: (42,13)-(42,15)) + │ │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ │ ├── value_loc: (42,13)-(42,14) = "a" + │ │ │ │ │ │ ├── closing_loc: (42,14)-(42,15) = ":" + │ │ │ │ │ │ └── unescaped: "a" + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ ImplicitNode (location: (42,13)-(42,14)) + │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ └── value: + │ │ │ │ │ │ @ LocalVariableTargetNode (location: (42,13)-(42,14)) + │ │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ │ ├── name: :a + │ │ │ │ │ │ └── depth: 0 + │ │ │ │ │ └── operator_loc: ∅ + │ │ │ │ └── @ AssocNode (location: (42,17)-(42,19)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (42,17)-(42,19)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (42,17)-(42,18) = "b" + │ │ │ │ │ ├── closing_loc: (42,18)-(42,19) = ":" + │ │ │ │ │ └── unescaped: "b" + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (42,17)-(42,18)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (42,17)-(42,18)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :b + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (42,25)-(42,29)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (42,25)-(42,29)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (42,10)-(42,12) = "in" + │ │ └── then_loc: (42,20)-(42,24) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (42,0)-(42,4) = "case" + │ └── end_keyword_loc: (42,31)-(42,34) = "end" + ├── @ CaseMatchNode (location: (44,0)-(44,36)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (44,5)-(44,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (44,5)-(44,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (44,10)-(44,31)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (44,13)-(44,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (44,15)-(44,19)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (44,15)-(44,17)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (44,15)-(44,16) = "a" + │ │ │ │ │ ├── closing_loc: (44,16)-(44,17) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (44,18)-(44,19)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (44,13)-(44,14) = "{" + │ │ │ └── closing_loc: (44,20)-(44,21) = "}" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (44,27)-(44,31)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (44,27)-(44,31)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (44,10)-(44,12) = "in" + │ │ └── then_loc: (44,22)-(44,26) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (44,0)-(44,4) = "case" + │ └── end_keyword_loc: (44,33)-(44,36) = "end" + ├── @ CaseMatchNode (location: (46,0)-(46,37)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (46,5)-(46,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (46,5)-(46,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (46,10)-(46,32)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ HashPatternNode (location: (46,13)-(46,22)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── elements: (length: 1) + │ │ │ │ └── @ AssocNode (location: (46,15)-(46,19)) + │ │ │ │ ├── flags: static_literal + │ │ │ │ ├── key: + │ │ │ │ │ @ SymbolNode (location: (46,15)-(46,17)) + │ │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ │ ├── value_loc: (46,15)-(46,16) = "a" + │ │ │ │ │ ├── closing_loc: (46,16)-(46,17) = ":" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── value: + │ │ │ │ │ @ IntegerNode (location: (46,18)-(46,19)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── operator_loc: ∅ + │ │ │ ├── rest: ∅ + │ │ │ ├── opening_loc: (46,13)-(46,14) = "{" + │ │ │ └── closing_loc: (46,21)-(46,22) = "}" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (46,28)-(46,32)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (46,28)-(46,32)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (46,10)-(46,12) = "in" + │ │ └── then_loc: (46,23)-(46,27) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (46,0)-(46,4) = "case" + │ └── end_keyword_loc: (46,34)-(46,37) = "end" + └── @ CaseMatchNode (location: (48,0)-(48,30)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (48,5)-(48,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (48,5)-(48,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (48,10)-(48,25)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ HashPatternNode (location: (48,13)-(48,15)) + │ │ ├── flags: ∅ + │ │ ├── constant: ∅ + │ │ ├── elements: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── opening_loc: (48,13)-(48,14) = "{" + │ │ └── closing_loc: (48,14)-(48,15) = "}" + │ ├── statements: + │ │ @ StatementsNode (location: (48,21)-(48,25)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (48,21)-(48,25)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (48,10)-(48,12) = "in" + │ └── then_loc: (48,16)-(48,20) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (48,0)-(48,4) = "case" + └── end_keyword_loc: (48,27)-(48,30) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt b/test/prism/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt new file mode 100644 index 00000000000..690bd54437e --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_if_unless_modifiers.txt @@ -0,0 +1,97 @@ +@ ProgramNode (location: (1,0)-(3,36)) +├── flags: ∅ +├── locals: [:x] +└── statements: + @ StatementsNode (location: (1,0)-(3,36)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ CaseMatchNode (location: (1,0)-(1,32)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,27)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ IfNode (location: (1,13)-(1,22)) + │ │ │ ├── flags: newline + │ │ │ ├── if_keyword_loc: (1,15)-(1,17) = "if" + │ │ │ ├── predicate: + │ │ │ │ @ TrueNode (location: (1,18)-(1,22)) + │ │ │ │ └── flags: static_literal + │ │ │ ├── then_keyword_loc: ∅ + │ │ │ ├── statements: + │ │ │ │ @ StatementsNode (location: (1,13)-(1,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (1,13)-(1,14)) + │ │ │ │ ├── flags: newline + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── subsequent: ∅ + │ │ │ └── end_keyword_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,24)-(1,27)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (1,24)-(1,27)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,29)-(1,32) = "end" + └── @ CaseMatchNode (location: (3,0)-(3,36)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (3,5)-(3,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (3,5)-(3,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (3,10)-(3,31)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ UnlessNode (location: (3,13)-(3,26)) + │ │ ├── flags: newline + │ │ ├── keyword_loc: (3,15)-(3,21) = "unless" + │ │ ├── predicate: + │ │ │ @ TrueNode (location: (3,22)-(3,26)) + │ │ │ └── flags: static_literal + │ │ ├── then_keyword_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,13)-(3,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ LocalVariableTargetNode (location: (3,13)-(3,14)) + │ │ │ ├── flags: newline + │ │ │ ├── name: :x + │ │ │ └── depth: 0 + │ │ ├── else_clause: ∅ + │ │ └── end_keyword_loc: ∅ + │ ├── statements: + │ │ @ StatementsNode (location: (3,28)-(3,31)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ NilNode (location: (3,28)-(3,31)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (3,10)-(3,12) = "in" + │ └── then_loc: ∅ + ├── else_clause: ∅ + ├── case_keyword_loc: (3,0)-(3,4) = "case" + └── end_keyword_loc: (3,33)-(3,36) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_implicit_array_match.txt b/test/prism/snapshots/whitequark/pattern_matching_implicit_array_match.txt new file mode 100644 index 00000000000..021ede47ab7 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_implicit_array_match.txt @@ -0,0 +1,387 @@ +@ ProgramNode (location: (1,0)-(15,32)) +├── flags: ∅ +├── locals: [:x, :y, :z] +└── statements: + @ StatementsNode (location: (1,0)-(15,32)) + ├── flags: ∅ + └── body: (length: 8) + ├── @ CaseMatchNode (location: (1,0)-(1,28)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,23)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (1,13)-(1,14)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (1,13)-(1,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (1,13)-(1,14) = "*" + │ │ │ │ └── expression: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,20)-(1,23)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (1,20)-(1,23)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: (1,15)-(1,19) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,25)-(1,28) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,29)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,24)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (3,13)-(3,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (3,13)-(3,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (3,13)-(3,14) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ LocalVariableTargetNode (location: (3,14)-(3,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,21)-(3,24)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (3,21)-(3,24)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,16)-(3,20) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,26)-(3,29) = "end" + ├── @ CaseMatchNode (location: (5,0)-(5,35)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (5,5)-(5,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (5,5)-(5,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (5,10)-(5,30)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (5,13)-(5,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 0) + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (5,13)-(5,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (5,13)-(5,14) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ LocalVariableTargetNode (location: (5,14)-(5,15)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── posts: (length: 2) + │ │ │ │ ├── @ LocalVariableTargetNode (location: (5,17)-(5,18)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :y + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── @ LocalVariableTargetNode (location: (5,20)-(5,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :z + │ │ │ │ └── depth: 0 + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,27)-(5,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (5,27)-(5,30)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (5,10)-(5,12) = "in" + │ │ └── then_loc: (5,22)-(5,26) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (5,0)-(5,4) = "case" + │ └── end_keyword_loc: (5,32)-(5,35) = "end" + ├── @ CaseMatchNode (location: (7,0)-(7,41)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (7,5)-(7,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (7,5)-(7,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (7,10)-(7,36)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (7,13)-(7,27)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 4) + │ │ │ │ ├── @ IntegerNode (location: (7,13)-(7,14)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ ├── @ StringNode (location: (7,16)-(7,19)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── opening_loc: (7,16)-(7,17) = "\"" + │ │ │ │ │ ├── content_loc: (7,17)-(7,18) = "a" + │ │ │ │ │ ├── closing_loc: (7,18)-(7,19) = "\"" + │ │ │ │ │ └── unescaped: "a" + │ │ │ │ ├── @ ArrayPatternNode (location: (7,21)-(7,23)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── constant: ∅ + │ │ │ │ │ ├── requireds: (length: 0) + │ │ │ │ │ ├── rest: ∅ + │ │ │ │ │ ├── posts: (length: 0) + │ │ │ │ │ ├── opening_loc: (7,21)-(7,22) = "[" + │ │ │ │ │ └── closing_loc: (7,22)-(7,23) = "]" + │ │ │ │ └── @ HashPatternNode (location: (7,25)-(7,27)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── constant: ∅ + │ │ │ │ ├── elements: (length: 0) + │ │ │ │ ├── rest: ∅ + │ │ │ │ ├── opening_loc: (7,25)-(7,26) = "{" + │ │ │ │ └── closing_loc: (7,26)-(7,27) = "}" + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (7,33)-(7,36)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (7,33)-(7,36)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (7,10)-(7,12) = "in" + │ │ └── then_loc: (7,28)-(7,32) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (7,0)-(7,4) = "case" + │ └── end_keyword_loc: (7,38)-(7,41) = "end" + ├── @ CaseMatchNode (location: (9,0)-(9,35)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (9,5)-(9,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (9,5)-(9,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (9,10)-(9,30)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (9,13)-(9,21)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (9,13)-(9,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ SplatNode (location: (9,16)-(9,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── operator_loc: (9,16)-(9,17) = "*" + │ │ │ │ └── expression: + │ │ │ │ @ LocalVariableTargetNode (location: (9,17)-(9,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── posts: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (9,20)-(9,21)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :z + │ │ │ │ └── depth: 0 + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (9,27)-(9,30)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (9,27)-(9,30)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (9,10)-(9,12) = "in" + │ │ └── then_loc: (9,22)-(9,26) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (9,0)-(9,4) = "case" + │ └── end_keyword_loc: (9,32)-(9,35) = "end" + ├── @ CaseMatchNode (location: (11,0)-(11,29)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (11,5)-(11,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (11,5)-(11,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (11,10)-(11,24)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (11,13)-(11,15)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 1) + │ │ │ │ └── @ LocalVariableTargetNode (location: (11,13)-(11,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: + │ │ │ │ @ ImplicitRestNode (location: (11,14)-(11,15)) + │ │ │ │ └── flags: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (11,21)-(11,24)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (11,21)-(11,24)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (11,10)-(11,12) = "in" + │ │ └── then_loc: (11,16)-(11,20) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (11,0)-(11,4) = "case" + │ └── end_keyword_loc: (11,26)-(11,29) = "end" + ├── @ CaseMatchNode (location: (13,0)-(13,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (13,5)-(13,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (13,5)-(13,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (13,10)-(13,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ ArrayPatternNode (location: (13,13)-(13,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── constant: ∅ + │ │ │ ├── requireds: (length: 2) + │ │ │ │ ├── @ LocalVariableTargetNode (location: (13,13)-(13,14)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 + │ │ │ │ └── @ LocalVariableTargetNode (location: (13,16)-(13,17)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :y + │ │ │ │ └── depth: 0 + │ │ │ ├── rest: ∅ + │ │ │ ├── posts: (length: 0) + │ │ │ ├── opening_loc: ∅ + │ │ │ └── closing_loc: ∅ + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (13,23)-(13,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (13,23)-(13,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (13,10)-(13,12) = "in" + │ │ └── then_loc: (13,18)-(13,22) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (13,0)-(13,4) = "case" + │ └── end_keyword_loc: (13,28)-(13,31) = "end" + └── @ CaseMatchNode (location: (15,0)-(15,32)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (15,5)-(15,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (15,5)-(15,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (15,10)-(15,27)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ ArrayPatternNode (location: (15,13)-(15,18)) + │ │ ├── flags: ∅ + │ │ ├── constant: ∅ + │ │ ├── requireds: (length: 2) + │ │ │ ├── @ LocalVariableTargetNode (location: (15,13)-(15,14)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── name: :x + │ │ │ │ └── depth: 0 + │ │ │ └── @ LocalVariableTargetNode (location: (15,16)-(15,17)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :y + │ │ │ └── depth: 0 + │ │ ├── rest: + │ │ │ @ ImplicitRestNode (location: (15,17)-(15,18)) + │ │ │ └── flags: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── opening_loc: ∅ + │ │ └── closing_loc: ∅ + │ ├── statements: + │ │ @ StatementsNode (location: (15,24)-(15,27)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ NilNode (location: (15,24)-(15,27)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (15,10)-(15,12) = "in" + │ └── then_loc: (15,19)-(15,23) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (15,0)-(15,4) = "case" + └── end_keyword_loc: (15,29)-(15,32) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_keyword_variable.txt b/test/prism/snapshots/whitequark/pattern_matching_keyword_variable.txt new file mode 100644 index 00000000000..282fd796fdc --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_keyword_variable.txt @@ -0,0 +1,37 @@ +@ ProgramNode (location: (1,0)-(1,32)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,32)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,32)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,27)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ SelfNode (location: (1,13)-(1,17)) + │ │ └── flags: ∅ + │ ├── statements: + │ │ @ StatementsNode (location: (1,23)-(1,27)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (1,23)-(1,27)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,18)-(1,22) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,29)-(1,32) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_lambda.txt b/test/prism/snapshots/whitequark/pattern_matching_lambda.txt new file mode 100644 index 00000000000..2b3db968155 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_lambda.txt @@ -0,0 +1,49 @@ +@ ProgramNode (location: (1,0)-(1,36)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,36)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,36)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,31)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ LambdaNode (location: (1,13)-(1,21)) + │ │ ├── flags: ∅ + │ │ ├── locals: [] + │ │ ├── operator_loc: (1,13)-(1,15) = "->" + │ │ ├── opening_loc: (1,15)-(1,16) = "{" + │ │ ├── closing_loc: (1,20)-(1,21) = "}" + │ │ ├── parameters: ∅ + │ │ └── body: + │ │ @ StatementsNode (location: (1,17)-(1,19)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ IntegerNode (location: (1,17)-(1,19)) + │ │ ├── flags: newline, static_literal, decimal + │ │ └── value: 42 + │ ├── statements: + │ │ @ StatementsNode (location: (1,27)-(1,31)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (1,27)-(1,31)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,22)-(1,26) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,33)-(1,36) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_match_alt.txt b/test/prism/snapshots/whitequark/pattern_matching_match_alt.txt new file mode 100644 index 00000000000..37c52fcef64 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_match_alt.txt @@ -0,0 +1,46 @@ +@ ProgramNode (location: (1,0)-(1,33)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,33)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,33)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,28)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ AlternationPatternNode (location: (1,13)-(1,18)) + │ │ ├── flags: ∅ + │ │ ├── left: + │ │ │ @ IntegerNode (location: (1,13)-(1,14)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── right: + │ │ │ @ IntegerNode (location: (1,17)-(1,18)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ └── operator_loc: (1,15)-(1,16) = "|" + │ ├── statements: + │ │ @ StatementsNode (location: (1,24)-(1,28)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (1,24)-(1,28)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,19)-(1,23) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,30)-(1,33) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_match_as.txt b/test/prism/snapshots/whitequark/pattern_matching_match_as.txt new file mode 100644 index 00000000000..81beffe0ec0 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_match_as.txt @@ -0,0 +1,47 @@ +@ ProgramNode (location: (1,0)-(1,34)) +├── flags: ∅ +├── locals: [:a] +└── statements: + @ StatementsNode (location: (1,0)-(1,34)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,34)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,29)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ CapturePatternNode (location: (1,13)-(1,19)) + │ │ ├── flags: ∅ + │ │ ├── value: + │ │ │ @ IntegerNode (location: (1,13)-(1,14)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── target: + │ │ │ @ LocalVariableTargetNode (location: (1,18)-(1,19)) + │ │ │ ├── flags: ∅ + │ │ │ ├── name: :a + │ │ │ └── depth: 0 + │ │ └── operator_loc: (1,15)-(1,17) = "=>" + │ ├── statements: + │ │ @ StatementsNode (location: (1,25)-(1,29)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (1,25)-(1,29)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,20)-(1,24) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,31)-(1,34) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_nil_pattern.txt b/test/prism/snapshots/whitequark/pattern_matching_nil_pattern.txt new file mode 100644 index 00000000000..8eed090e490 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_nil_pattern.txt @@ -0,0 +1,46 @@ +@ ProgramNode (location: (1,0)-(1,33)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,33)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,33)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,28)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ HashPatternNode (location: (1,13)-(1,18)) + │ │ ├── flags: ∅ + │ │ ├── constant: ∅ + │ │ ├── elements: (length: 0) + │ │ ├── rest: + │ │ │ @ NoKeywordsParameterNode (location: (1,13)-(1,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── operator_loc: (1,13)-(1,15) = "**" + │ │ │ └── keyword_loc: (1,15)-(1,18) = "nil" + │ │ ├── opening_loc: ∅ + │ │ └── closing_loc: ∅ + │ ├── statements: + │ │ @ StatementsNode (location: (1,24)-(1,28)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (1,24)-(1,28)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,19)-(1,23) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,30)-(1,33) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_no_body.txt b/test/prism/snapshots/whitequark/pattern_matching_no_body.txt new file mode 100644 index 00000000000..9b83bd64475 --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_no_body.txt @@ -0,0 +1,33 @@ +@ ProgramNode (location: (1,0)-(1,19)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,19)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,19)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,14)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ IntegerNode (location: (1,13)-(1,14)) + │ │ ├── flags: static_literal, decimal + │ │ └── value: 1 + │ ├── statements: ∅ + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: ∅ + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,16)-(1,19) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_ranges.txt b/test/prism/snapshots/whitequark/pattern_matching_ranges.txt new file mode 100644 index 00000000000..e8cd3afcaaa --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_ranges.txt @@ -0,0 +1,229 @@ +@ ProgramNode (location: (1,0)-(11,32)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(11,32)) + ├── flags: ∅ + └── body: (length: 6) + ├── @ CaseMatchNode (location: (1,0)-(1,32)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,27)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ RangeNode (location: (1,13)-(1,17)) + │ │ │ ├── flags: static_literal, exclude_end + │ │ │ ├── left: ∅ + │ │ │ ├── right: + │ │ │ │ @ IntegerNode (location: (1,16)-(1,17)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ └── operator_loc: (1,13)-(1,16) = "..." + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (1,23)-(1,27)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (1,23)-(1,27)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: (1,18)-(1,22) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,29)-(1,32) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ RangeNode (location: (3,13)-(3,16)) + │ │ │ ├── flags: static_literal + │ │ │ ├── left: ∅ + │ │ │ ├── right: + │ │ │ │ @ IntegerNode (location: (3,15)-(3,16)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ └── operator_loc: (3,13)-(3,15) = ".." + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,22)-(3,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (3,22)-(3,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,17)-(3,21) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,28)-(3,31) = "end" + ├── @ CaseMatchNode (location: (5,0)-(5,31)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (5,5)-(5,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (5,5)-(5,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (5,10)-(5,26)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ RangeNode (location: (5,13)-(5,16)) + │ │ │ ├── flags: static_literal + │ │ │ ├── left: + │ │ │ │ @ IntegerNode (location: (5,13)-(5,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── right: ∅ + │ │ │ └── operator_loc: (5,14)-(5,16) = ".." + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (5,22)-(5,26)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (5,22)-(5,26)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (5,10)-(5,12) = "in" + │ │ └── then_loc: (5,17)-(5,21) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (5,0)-(5,4) = "case" + │ └── end_keyword_loc: (5,28)-(5,31) = "end" + ├── @ CaseMatchNode (location: (7,0)-(7,32)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (7,5)-(7,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (7,5)-(7,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (7,10)-(7,27)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ RangeNode (location: (7,13)-(7,17)) + │ │ │ ├── flags: static_literal, exclude_end + │ │ │ ├── left: + │ │ │ │ @ IntegerNode (location: (7,13)-(7,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── right: ∅ + │ │ │ └── operator_loc: (7,14)-(7,17) = "..." + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (7,23)-(7,27)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (7,23)-(7,27)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (7,10)-(7,12) = "in" + │ │ └── then_loc: (7,18)-(7,22) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (7,0)-(7,4) = "case" + │ └── end_keyword_loc: (7,29)-(7,32) = "end" + ├── @ CaseMatchNode (location: (9,0)-(9,33)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (9,5)-(9,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (9,5)-(9,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (9,10)-(9,28)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ RangeNode (location: (9,13)-(9,18)) + │ │ │ ├── flags: static_literal, exclude_end + │ │ │ ├── left: + │ │ │ │ @ IntegerNode (location: (9,13)-(9,14)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── right: + │ │ │ │ @ IntegerNode (location: (9,17)-(9,18)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ └── operator_loc: (9,14)-(9,17) = "..." + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (9,24)-(9,28)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ TrueNode (location: (9,24)-(9,28)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (9,10)-(9,12) = "in" + │ │ └── then_loc: (9,19)-(9,23) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (9,0)-(9,4) = "case" + │ └── end_keyword_loc: (9,30)-(9,33) = "end" + └── @ CaseMatchNode (location: (11,0)-(11,32)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (11,5)-(11,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (11,5)-(11,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (11,10)-(11,27)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ RangeNode (location: (11,13)-(11,17)) + │ │ ├── flags: static_literal + │ │ ├── left: + │ │ │ @ IntegerNode (location: (11,13)-(11,14)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 1 + │ │ ├── right: + │ │ │ @ IntegerNode (location: (11,16)-(11,17)) + │ │ │ ├── flags: static_literal, decimal + │ │ │ └── value: 2 + │ │ └── operator_loc: (11,14)-(11,16) = ".." + │ ├── statements: + │ │ @ StatementsNode (location: (11,23)-(11,27)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ TrueNode (location: (11,23)-(11,27)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (11,10)-(11,12) = "in" + │ └── then_loc: (11,18)-(11,22) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (11,0)-(11,4) = "case" + └── end_keyword_loc: (11,29)-(11,32) = "end" diff --git a/test/prism/snapshots/whitequark/pattern_matching_single_match.txt b/test/prism/snapshots/whitequark/pattern_matching_single_match.txt new file mode 100644 index 00000000000..117730bdb2a --- /dev/null +++ b/test/prism/snapshots/whitequark/pattern_matching_single_match.txt @@ -0,0 +1,41 @@ +@ ProgramNode (location: (1,0)-(1,26)) +├── flags: ∅ +├── locals: [:x] +└── statements: + @ StatementsNode (location: (1,0)-(1,26)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CaseMatchNode (location: (1,0)-(1,26)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (1,5)-(1,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (1,5)-(1,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (1,10)-(1,21)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ LocalVariableTargetNode (location: (1,13)-(1,14)) + │ │ ├── flags: ∅ + │ │ ├── name: :x + │ │ └── depth: 0 + │ ├── statements: + │ │ @ StatementsNode (location: (1,20)-(1,21)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ LocalVariableReadNode (location: (1,20)-(1,21)) + │ │ ├── flags: newline + │ │ ├── name: :x + │ │ └── depth: 0 + │ ├── in_loc: (1,10)-(1,12) = "in" + │ └── then_loc: (1,15)-(1,19) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (1,0)-(1,4) = "case" + └── end_keyword_loc: (1,23)-(1,26) = "end" diff --git a/test/prism/snapshots/whitequark/pin_expr.txt b/test/prism/snapshots/whitequark/pin_expr.txt new file mode 100644 index 00000000000..c9a36e112f9 --- /dev/null +++ b/test/prism/snapshots/whitequark/pin_expr.txt @@ -0,0 +1,274 @@ +@ ProgramNode (location: (1,0)-(14,41)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(14,41)) + ├── flags: ∅ + └── body: (length: 7) + ├── @ CaseMatchNode (location: (1,0)-(1,39)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (1,5)-(1,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (1,5)-(1,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (1,10)-(1,34)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ PinnedVariableNode (location: (1,13)-(1,34)) + │ │ │ ├── flags: ∅ + │ │ │ ├── variable: + │ │ │ │ @ GlobalVariableReadNode (location: (1,14)-(1,34)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :$TestPatternMatching + │ │ │ └── operator_loc: (1,13)-(1,14) = "^" + │ │ ├── statements: ∅ + │ │ ├── in_loc: (1,10)-(1,12) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (1,0)-(1,4) = "case" + │ └── end_keyword_loc: (1,36)-(1,39) = "end" + ├── @ CaseMatchNode (location: (3,0)-(3,33)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (3,5)-(3,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (3,5)-(3,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (3,10)-(3,28)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ PinnedExpressionNode (location: (3,13)-(3,19)) + │ │ │ ├── flags: ∅ + │ │ │ ├── expression: + │ │ │ │ @ CallNode (location: (3,15)-(3,18)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── receiver: + │ │ │ │ │ @ IntegerNode (location: (3,15)-(3,16)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 0 + │ │ │ │ ├── call_operator_loc: ∅ + │ │ │ │ ├── name: :+ + │ │ │ │ ├── message_loc: (3,16)-(3,17) = "+" + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── arguments: + │ │ │ │ │ @ ArgumentsNode (location: (3,17)-(3,18)) + │ │ │ │ │ ├── flags: ∅ + │ │ │ │ │ └── arguments: (length: 1) + │ │ │ │ │ └── @ IntegerNode (location: (3,17)-(3,18)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 0 + │ │ │ │ ├── closing_loc: ∅ + │ │ │ │ └── block: ∅ + │ │ │ ├── operator_loc: (3,13)-(3,14) = "^" + │ │ │ ├── lparen_loc: (3,14)-(3,15) = "(" + │ │ │ └── rparen_loc: (3,18)-(3,19) = ")" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (3,25)-(3,28)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (3,25)-(3,28)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (3,10)-(3,12) = "in" + │ │ └── then_loc: (3,20)-(3,24) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (3,0)-(3,4) = "case" + │ └── end_keyword_loc: (3,30)-(3,33) = "end" + ├── @ CaseMatchNode (location: (5,0)-(6,6)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (5,5)-(5,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (5,5)-(5,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (5,10)-(6,1)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ PinnedExpressionNode (location: (5,13)-(6,1)) + │ │ │ ├── flags: ∅ + │ │ │ ├── expression: + │ │ │ │ @ IntegerNode (location: (5,15)-(5,16)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 1 + │ │ │ ├── operator_loc: (5,13)-(5,14) = "^" + │ │ │ ├── lparen_loc: (5,14)-(5,15) = "(" + │ │ │ └── rparen_loc: (6,0)-(6,1) = ")" + │ │ ├── statements: ∅ + │ │ ├── in_loc: (5,10)-(5,12) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (5,0)-(5,4) = "case" + │ └── end_keyword_loc: (6,3)-(6,6) = "end" + ├── @ CaseMatchNode (location: (8,0)-(8,32)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (8,5)-(8,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (8,5)-(8,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (8,10)-(8,27)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ PinnedExpressionNode (location: (8,13)-(8,18)) + │ │ │ ├── flags: ∅ + │ │ │ ├── expression: + │ │ │ │ @ IntegerNode (location: (8,15)-(8,17)) + │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ └── value: 42 + │ │ │ ├── operator_loc: (8,13)-(8,14) = "^" + │ │ │ ├── lparen_loc: (8,14)-(8,15) = "(" + │ │ │ └── rparen_loc: (8,17)-(8,18) = ")" + │ │ ├── statements: + │ │ │ @ StatementsNode (location: (8,24)-(8,27)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ NilNode (location: (8,24)-(8,27)) + │ │ │ └── flags: newline, static_literal + │ │ ├── in_loc: (8,10)-(8,12) = "in" + │ │ └── then_loc: (8,19)-(8,23) = "then" + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (8,0)-(8,4) = "case" + │ └── end_keyword_loc: (8,29)-(8,32) = "end" + ├── @ CaseMatchNode (location: (10,0)-(10,40)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (10,5)-(10,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (10,5)-(10,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (10,10)-(10,35)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ PinnedVariableNode (location: (10,13)-(10,35)) + │ │ │ ├── flags: ∅ + │ │ │ ├── variable: + │ │ │ │ @ ClassVariableReadNode (location: (10,14)-(10,35)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :@@TestPatternMatching + │ │ │ └── operator_loc: (10,13)-(10,14) = "^" + │ │ ├── statements: ∅ + │ │ ├── in_loc: (10,10)-(10,12) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (10,0)-(10,4) = "case" + │ └── end_keyword_loc: (10,37)-(10,40) = "end" + ├── @ CaseMatchNode (location: (12,0)-(12,21)) + │ ├── flags: newline + │ ├── predicate: + │ │ @ CallNode (location: (12,5)-(12,8)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :foo + │ │ ├── message_loc: (12,5)-(12,8) = "foo" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── conditions: (length: 1) + │ │ └── @ InNode (location: (12,10)-(12,16)) + │ │ ├── flags: ∅ + │ │ ├── pattern: + │ │ │ @ PinnedVariableNode (location: (12,13)-(12,16)) + │ │ │ ├── flags: ∅ + │ │ │ ├── variable: + │ │ │ │ @ InstanceVariableReadNode (location: (12,14)-(12,16)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── name: :@a + │ │ │ └── operator_loc: (12,13)-(12,14) = "^" + │ │ ├── statements: ∅ + │ │ ├── in_loc: (12,10)-(12,12) = "in" + │ │ └── then_loc: ∅ + │ ├── else_clause: ∅ + │ ├── case_keyword_loc: (12,0)-(12,4) = "case" + │ └── end_keyword_loc: (12,18)-(12,21) = "end" + └── @ CaseMatchNode (location: (14,0)-(14,41)) + ├── flags: newline + ├── predicate: + │ @ CallNode (location: (14,5)-(14,8)) + │ ├── flags: variable_call, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :foo + │ ├── message_loc: (14,5)-(14,8) = "foo" + │ ├── opening_loc: ∅ + │ ├── arguments: ∅ + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── conditions: (length: 1) + │ └── @ InNode (location: (14,10)-(14,36)) + │ ├── flags: ∅ + │ ├── pattern: + │ │ @ HashPatternNode (location: (14,13)-(14,27)) + │ │ ├── flags: ∅ + │ │ ├── constant: ∅ + │ │ ├── elements: (length: 1) + │ │ │ └── @ AssocNode (location: (14,15)-(14,25)) + │ │ │ ├── flags: ∅ + │ │ │ ├── key: + │ │ │ │ @ SymbolNode (location: (14,15)-(14,19)) + │ │ │ │ ├── flags: static_literal, forced_us_ascii_encoding + │ │ │ │ ├── opening_loc: ∅ + │ │ │ │ ├── value_loc: (14,15)-(14,18) = "foo" + │ │ │ │ ├── closing_loc: (14,18)-(14,19) = ":" + │ │ │ │ └── unescaped: "foo" + │ │ │ ├── value: + │ │ │ │ @ PinnedExpressionNode (location: (14,20)-(14,25)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ ├── expression: + │ │ │ │ │ @ IntegerNode (location: (14,22)-(14,24)) + │ │ │ │ │ ├── flags: static_literal, decimal + │ │ │ │ │ └── value: 42 + │ │ │ │ ├── operator_loc: (14,20)-(14,21) = "^" + │ │ │ │ ├── lparen_loc: (14,21)-(14,22) = "(" + │ │ │ │ └── rparen_loc: (14,24)-(14,25) = ")" + │ │ │ └── operator_loc: ∅ + │ │ ├── rest: ∅ + │ │ ├── opening_loc: (14,13)-(14,14) = "{" + │ │ └── closing_loc: (14,26)-(14,27) = "}" + │ ├── statements: + │ │ @ StatementsNode (location: (14,33)-(14,36)) + │ │ ├── flags: ∅ + │ │ └── body: (length: 1) + │ │ └── @ NilNode (location: (14,33)-(14,36)) + │ │ └── flags: newline, static_literal + │ ├── in_loc: (14,10)-(14,12) = "in" + │ └── then_loc: (14,28)-(14,32) = "then" + ├── else_clause: ∅ + ├── case_keyword_loc: (14,0)-(14,4) = "case" + └── end_keyword_loc: (14,38)-(14,41) = "end" diff --git a/test/prism/snapshots/whitequark/procarg0_legacy.txt b/test/prism/snapshots/whitequark/procarg0_legacy.txt new file mode 100644 index 00000000000..aebe56988e5 --- /dev/null +++ b/test/prism/snapshots/whitequark/procarg0_legacy.txt @@ -0,0 +1,42 @@ +@ ProgramNode (location: (1,0)-(1,8)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,8)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,8)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :f + ├── message_loc: (1,0)-(1,1) = "f" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,1)-(1,8)) + ├── flags: ∅ + ├── locals: [:a] + ├── parameters: + │ @ BlockParametersNode (location: (1,3)-(1,6)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,4)-(1,5)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (1,4)-(1,5)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (1,3)-(1,4) = "|" + │ └── closing_loc: (1,5)-(1,6) = "|" + ├── body: ∅ + ├── opening_loc: (1,1)-(1,2) = "{" + └── closing_loc: (1,7)-(1,8) = "}" diff --git a/test/prism/snapshots/whitequark/ruby_bug_18878.txt b/test/prism/snapshots/whitequark/ruby_bug_18878.txt new file mode 100644 index 00000000000..feff9defb31 --- /dev/null +++ b/test/prism/snapshots/whitequark/ruby_bug_18878.txt @@ -0,0 +1,51 @@ +@ ProgramNode (location: (1,0)-(1,19)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(1,19)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(1,19)) + ├── flags: newline + ├── receiver: + │ @ ConstantReadNode (location: (1,0)-(1,3)) + │ ├── flags: ∅ + │ └── name: :Foo + ├── call_operator_loc: (1,3)-(1,5) = "::" + ├── name: :Bar + ├── message_loc: (1,5)-(1,8) = "Bar" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,9)-(1,19)) + ├── flags: ∅ + ├── locals: [:a] + ├── parameters: + │ @ BlockParametersNode (location: (1,11)-(1,14)) + │ ├── flags: ∅ + │ ├── parameters: + │ │ @ ParametersNode (location: (1,12)-(1,13)) + │ │ ├── flags: ∅ + │ │ ├── requireds: (length: 1) + │ │ │ └── @ RequiredParameterNode (location: (1,12)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ └── name: :a + │ │ ├── optionals: (length: 0) + │ │ ├── rest: ∅ + │ │ ├── posts: (length: 0) + │ │ ├── keywords: (length: 0) + │ │ ├── keyword_rest: ∅ + │ │ └── block: ∅ + │ ├── locals: (length: 0) + │ ├── opening_loc: (1,11)-(1,12) = "|" + │ └── closing_loc: (1,13)-(1,14) = "|" + ├── body: + │ @ StatementsNode (location: (1,15)-(1,17)) + │ ├── flags: ∅ + │ └── body: (length: 1) + │ └── @ IntegerNode (location: (1,15)-(1,17)) + │ ├── flags: newline, static_literal, decimal + │ └── value: 42 + ├── opening_loc: (1,9)-(1,10) = "{" + └── closing_loc: (1,18)-(1,19) = "}" diff --git a/test/prism/snapshots/whitequark/ruby_bug_19281.txt b/test/prism/snapshots/whitequark/ruby_bug_19281.txt new file mode 100644 index 00000000000..3d7786b35c5 --- /dev/null +++ b/test/prism/snapshots/whitequark/ruby_bug_19281.txt @@ -0,0 +1,181 @@ +@ ProgramNode (location: (1,0)-(7,11)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(7,11)) + ├── flags: ∅ + └── body: (length: 4) + ├── @ CallNode (location: (1,0)-(1,17)) + │ ├── flags: newline + │ ├── receiver: + │ │ @ CallNode (location: (1,0)-(1,1)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :a + │ │ ├── message_loc: (1,0)-(1,1) = "a" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── call_operator_loc: (1,1)-(1,2) = "." + │ ├── name: :b + │ ├── message_loc: (1,2)-(1,3) = "b" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (1,4)-(1,17)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 3) + │ │ ├── @ ParenthesesNode (location: (1,4)-(1,9)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (1,5)-(1,8)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 2) + │ │ │ │ ├── @ IntegerNode (location: (1,5)-(1,6)) + │ │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── @ IntegerNode (location: (1,7)-(1,8)) + │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ ├── opening_loc: (1,4)-(1,5) = "(" + │ │ │ └── closing_loc: (1,8)-(1,9) = ")" + │ │ ├── @ ParenthesesNode (location: (1,10)-(1,13)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (1,11)-(1,12)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (1,11)-(1,12)) + │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ └── value: 3 + │ │ │ ├── opening_loc: (1,10)-(1,11) = "(" + │ │ │ └── closing_loc: (1,12)-(1,13) = ")" + │ │ └── @ ParenthesesNode (location: (1,14)-(1,17)) + │ │ ├── flags: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (1,15)-(1,16)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ IntegerNode (location: (1,15)-(1,16)) + │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ └── value: 4 + │ │ ├── opening_loc: (1,14)-(1,15) = "(" + │ │ └── closing_loc: (1,16)-(1,17) = ")" + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (3,0)-(3,13)) + │ ├── flags: newline + │ ├── receiver: + │ │ @ CallNode (location: (3,0)-(3,1)) + │ │ ├── flags: variable_call, ignore_visibility + │ │ ├── receiver: ∅ + │ │ ├── call_operator_loc: ∅ + │ │ ├── name: :a + │ │ ├── message_loc: (3,0)-(3,1) = "a" + │ │ ├── opening_loc: ∅ + │ │ ├── arguments: ∅ + │ │ ├── closing_loc: ∅ + │ │ └── block: ∅ + │ ├── call_operator_loc: (3,1)-(3,2) = "." + │ ├── name: :b + │ ├── message_loc: (3,2)-(3,3) = "b" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (3,4)-(3,13)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 3) + │ │ ├── @ ParenthesesNode (location: (3,4)-(3,7)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: ∅ + │ │ │ ├── opening_loc: (3,4)-(3,5) = "(" + │ │ │ └── closing_loc: (3,6)-(3,7) = ")" + │ │ ├── @ ParenthesesNode (location: (3,8)-(3,10)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: ∅ + │ │ │ ├── opening_loc: (3,8)-(3,9) = "(" + │ │ │ └── closing_loc: (3,9)-(3,10) = ")" + │ │ └── @ ParenthesesNode (location: (3,11)-(3,13)) + │ │ ├── flags: ∅ + │ │ ├── body: ∅ + │ │ ├── opening_loc: (3,11)-(3,12) = "(" + │ │ └── closing_loc: (3,12)-(3,13) = ")" + │ ├── closing_loc: ∅ + │ └── block: ∅ + ├── @ CallNode (location: (5,0)-(5,15)) + │ ├── flags: newline, ignore_visibility + │ ├── receiver: ∅ + │ ├── call_operator_loc: ∅ + │ ├── name: :p + │ ├── message_loc: (5,0)-(5,1) = "p" + │ ├── opening_loc: ∅ + │ ├── arguments: + │ │ @ ArgumentsNode (location: (5,2)-(5,15)) + │ │ ├── flags: ∅ + │ │ └── arguments: (length: 3) + │ │ ├── @ ParenthesesNode (location: (5,2)-(5,7)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (5,3)-(5,6)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 2) + │ │ │ │ ├── @ IntegerNode (location: (5,3)-(5,4)) + │ │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ │ └── value: 1 + │ │ │ │ └── @ IntegerNode (location: (5,5)-(5,6)) + │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ └── value: 2 + │ │ │ ├── opening_loc: (5,2)-(5,3) = "(" + │ │ │ └── closing_loc: (5,6)-(5,7) = ")" + │ │ ├── @ ParenthesesNode (location: (5,8)-(5,11)) + │ │ │ ├── flags: ∅ + │ │ │ ├── body: + │ │ │ │ @ StatementsNode (location: (5,9)-(5,10)) + │ │ │ │ ├── flags: ∅ + │ │ │ │ └── body: (length: 1) + │ │ │ │ └── @ IntegerNode (location: (5,9)-(5,10)) + │ │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ │ └── value: 3 + │ │ │ ├── opening_loc: (5,8)-(5,9) = "(" + │ │ │ └── closing_loc: (5,10)-(5,11) = ")" + │ │ └── @ ParenthesesNode (location: (5,12)-(5,15)) + │ │ ├── flags: ∅ + │ │ ├── body: + │ │ │ @ StatementsNode (location: (5,13)-(5,14)) + │ │ │ ├── flags: ∅ + │ │ │ └── body: (length: 1) + │ │ │ └── @ IntegerNode (location: (5,13)-(5,14)) + │ │ │ ├── flags: newline, static_literal, decimal + │ │ │ └── value: 4 + │ │ ├── opening_loc: (5,12)-(5,13) = "(" + │ │ └── closing_loc: (5,14)-(5,15) = ")" + │ ├── closing_loc: ∅ + │ └── block: ∅ + └── @ CallNode (location: (7,0)-(7,11)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :p + ├── message_loc: (7,0)-(7,1) = "p" + ├── opening_loc: ∅ + ├── arguments: + │ @ ArgumentsNode (location: (7,2)-(7,11)) + │ ├── flags: ∅ + │ └── arguments: (length: 3) + │ ├── @ ParenthesesNode (location: (7,2)-(7,5)) + │ │ ├── flags: ∅ + │ │ ├── body: ∅ + │ │ ├── opening_loc: (7,2)-(7,3) = "(" + │ │ └── closing_loc: (7,4)-(7,5) = ")" + │ ├── @ ParenthesesNode (location: (7,6)-(7,8)) + │ │ ├── flags: ∅ + │ │ ├── body: ∅ + │ │ ├── opening_loc: (7,6)-(7,7) = "(" + │ │ └── closing_loc: (7,7)-(7,8) = ")" + │ └── @ ParenthesesNode (location: (7,9)-(7,11)) + │ ├── flags: ∅ + │ ├── body: ∅ + │ ├── opening_loc: (7,9)-(7,10) = "(" + │ └── closing_loc: (7,10)-(7,11) = ")" + ├── closing_loc: ∅ + └── block: ∅ diff --git a/test/prism/snapshots/whitequark/ruby_bug_19539.txt b/test/prism/snapshots/whitequark/ruby_bug_19539.txt new file mode 100644 index 00000000000..9cd8641e66e --- /dev/null +++ b/test/prism/snapshots/whitequark/ruby_bug_19539.txt @@ -0,0 +1,19 @@ +@ ProgramNode (location: (1,0)-(6,9)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(6,9)) + ├── flags: ∅ + └── body: (length: 2) + ├── @ StringNode (location: (1,0)-(1,8)) + │ ├── flags: newline + │ ├── opening_loc: (1,0)-(1,8) = "<<' FOO'" + │ ├── content_loc: (2,0)-(3,0) = "[Bug #19539]\n" + │ ├── closing_loc: (3,0)-(4,0) = " FOO\n" + │ └── unescaped: "[Bug #19539]\n" + └── @ StringNode (location: (6,0)-(6,9)) + ├── flags: newline + ├── opening_loc: (6,0)-(6,9) = "<<-' FOO'" + ├── content_loc: (7,0)-(8,0) = "[Bug #19539]\n" + ├── closing_loc: (8,0)-(9,0) = " FOO\n" + └── unescaped: "[Bug #19539]\n"