summaryrefslogtreecommitdiff
path: root/test/ripper/test_sexp.rb
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2023-04-01 16:28:05 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2023-04-01 16:35:24 +0900
commit4ac8d1172483634bb24183b8ad2aaa03435b17a3 (patch)
treeda84c2d3427b9dec3b90295bf493620f16eb5a53 /test/ripper/test_sexp.rb
parent3a238eff88440f450a7871fc82e49bfb1ab336e5 (diff)
`*` in an array pattern should not be parsed as nil in ripper
After 6c0925ba7017efde6091e2ec4f1a6be268166696, it was impossible to distinguish between the presence or absence of `*`. # Before the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, [:var_field, nil], nil] # After the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] This commit reverts it.
Diffstat (limited to 'test/ripper/test_sexp.rb')
-rw-r--r--test/ripper/test_sexp.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index 1bc99b9b97..a1cf5e4f0a 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -229,7 +229,7 @@ eot
[__LINE__, %q{ case 0; in *; end }] =>
[:case,
[:@int, "0", [1, 5]],
- [:in, [:aryptn, nil, nil, nil, nil], [[:void_stmt]], nil]],
+ [:in, [:aryptn, nil, nil, [:var_field, nil], nil], [[:void_stmt]], nil]],
[__LINE__, %q{ case 0; in *,a; end }] =>
[:case,
@@ -238,7 +238,7 @@ eot
[:aryptn,
nil,
nil,
- nil,
+ [:var_field, nil],
[[:var_field, [:@ident, "a", [1, 13]]]]],
[[:void_stmt]],
nil]],
@@ -426,9 +426,9 @@ eot
[:in,
[:fndptn,
nil,
- nil,
+ [:var_field, nil],
[[:var_field, [:@ident, "a", [1, 9]]]],
- nil],
+ [:var_field, nil]],
nil,
nil]],