diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-01-24 12:11:45 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-01-24 18:37:36 +0000 |
commit | 455fb320384a597bc195adcee6bc1071fc64a245 (patch) | |
tree | 66faab91d693b4f5474cbca250634e36d4ea3e22 /test/prism | |
parent | 303fef875240b19fc582ab80897f5e15df784eca (diff) | |
download | ruby-455fb320384a597bc195adcee6bc1071fc64a245.tar.gz |
[ruby/prism] Add an implicit node for the target of a hash pattern
This simplifies compiling it, since you can now compile the value
as if it were always there.
https://github.com/ruby/prism/commit/bcfc74aacb
Diffstat (limited to 'test/prism')
9 files changed, 90 insertions, 15 deletions
diff --git a/test/prism/snapshots/patterns.txt b/test/prism/snapshots/patterns.txt index 17bd04f3bc..eed0a8e2b7 100644 --- a/test/prism/snapshots/patterns.txt +++ b/test/prism/snapshots/patterns.txt @@ -4757,7 +4757,12 @@ │ │ │ │ │ ├── value_loc: (202,15)-(202,16) = "x" │ │ │ │ │ ├── closing_loc: (202,16)-(202,17) = ":" │ │ │ │ │ └── unescaped: "x" - │ │ │ │ ├── value: ∅ + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (202,15)-(202,16)) + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (202,15)-(202,16)) + │ │ │ │ │ ├── name: :x + │ │ │ │ │ └── depth: 0 │ │ │ │ └── operator_loc: ∅ │ │ │ ├── rest: ∅ │ │ │ ├── opening_loc: (202,14)-(202,15) = "{" diff --git a/test/prism/snapshots/seattlerb/case_in.txt b/test/prism/snapshots/seattlerb/case_in.txt index 94ff42b8b2..96a76174d2 100644 --- a/test/prism/snapshots/seattlerb/case_in.txt +++ b/test/prism/snapshots/seattlerb/case_in.txt @@ -25,7 +25,12 @@ │ │ │ │ │ ├── value_loc: (2,5)-(2,6) = "b" │ │ │ │ │ ├── closing_loc: (2,6)-(2,8) = "\":" │ │ │ │ │ └── unescaped: "b" - │ │ │ │ ├── value: ∅ + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (2,5)-(2,6)) + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (2,5)-(2,6)) + │ │ │ │ │ ├── name: :b + │ │ │ │ │ └── depth: 0 │ │ │ │ └── operator_loc: ∅ │ │ │ ├── rest: ∅ │ │ │ ├── opening_loc: ∅ @@ -905,7 +910,12 @@ │ │ │ │ │ ├── value_loc: (106,6)-(106,7) = "b" │ │ │ │ │ ├── closing_loc: (106,7)-(106,9) = "\":" │ │ │ │ │ └── unescaped: "b" - │ │ │ │ ├── value: ∅ + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (106,6)-(106,7)) + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (106,6)-(106,7)) + │ │ │ │ │ ├── name: :b + │ │ │ │ │ └── depth: 0 │ │ │ │ └── operator_loc: ∅ │ │ │ ├── rest: ∅ │ │ │ ├── opening_loc: (106,3)-(106,4) = "{" diff --git a/test/prism/snapshots/seattlerb/case_in_hash_pat_assign.txt b/test/prism/snapshots/seattlerb/case_in_hash_pat_assign.txt index 17136fd0bc..9863dfbc3f 100644 --- a/test/prism/snapshots/seattlerb/case_in_hash_pat_assign.txt +++ b/test/prism/snapshots/seattlerb/case_in_hash_pat_assign.txt @@ -60,7 +60,12 @@ │ │ │ │ ├── value_loc: (2,30)-(2,31) = "f" │ │ │ │ ├── closing_loc: (2,31)-(2,32) = ":" │ │ │ │ └── unescaped: "f" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (2,30)-(2,31)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (2,30)-(2,31)) + │ │ │ │ ├── name: :f + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: ∅ │ │ ├── opening_loc: (2,3)-(2,4) = "{" diff --git a/test/prism/snapshots/seattlerb/parse_pattern_058.txt b/test/prism/snapshots/seattlerb/parse_pattern_058.txt index d372ece2d4..66db776bcb 100644 --- a/test/prism/snapshots/seattlerb/parse_pattern_058.txt +++ b/test/prism/snapshots/seattlerb/parse_pattern_058.txt @@ -35,7 +35,12 @@ │ │ │ │ ├── value_loc: (2,4)-(2,5) = "a" │ │ │ │ ├── closing_loc: (2,5)-(2,6) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (2,4)-(2,5)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (2,4)-(2,5)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: │ │ │ @ AssocSplatNode (location: (2,8)-(2,14)) diff --git a/test/prism/snapshots/seattlerb/parse_pattern_058_2.txt b/test/prism/snapshots/seattlerb/parse_pattern_058_2.txt index b75b198907..075084ed96 100644 --- a/test/prism/snapshots/seattlerb/parse_pattern_058_2.txt +++ b/test/prism/snapshots/seattlerb/parse_pattern_058_2.txt @@ -35,7 +35,12 @@ │ │ │ │ ├── value_loc: (2,4)-(2,5) = "a" │ │ │ │ ├── closing_loc: (2,5)-(2,6) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (2,4)-(2,5)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (2,4)-(2,5)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: │ │ │ @ AssocSplatNode (location: (2,8)-(2,10)) diff --git a/test/prism/snapshots/unparser/corpus/literal/pattern.txt b/test/prism/snapshots/unparser/corpus/literal/pattern.txt index 1a5113160d..b55309472a 100644 --- a/test/prism/snapshots/unparser/corpus/literal/pattern.txt +++ b/test/prism/snapshots/unparser/corpus/literal/pattern.txt @@ -89,7 +89,12 @@ │ │ │ │ │ │ ├── value_loc: (6,5)-(6,6) = "x" │ │ │ │ │ │ ├── closing_loc: (6,6)-(6,7) = ":" │ │ │ │ │ │ └── unescaped: "x" - │ │ │ │ │ ├── value: ∅ + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ ImplicitNode (location: (6,5)-(6,6)) + │ │ │ │ │ │ └── value: + │ │ │ │ │ │ @ LocalVariableTargetNode (location: (6,5)-(6,6)) + │ │ │ │ │ │ ├── name: :x + │ │ │ │ │ │ └── depth: 0 │ │ │ │ │ └── operator_loc: ∅ │ │ │ │ ├── rest: ∅ │ │ │ │ ├── opening_loc: (6,4)-(6,5) = "(" diff --git a/test/prism/snapshots/whitequark/multiple_pattern_matches.txt b/test/prism/snapshots/whitequark/multiple_pattern_matches.txt index 856ecc8c67..3150bfb8e2 100644 --- a/test/prism/snapshots/whitequark/multiple_pattern_matches.txt +++ b/test/prism/snapshots/whitequark/multiple_pattern_matches.txt @@ -33,7 +33,12 @@ │ │ │ │ ├── value_loc: (1,10)-(1,11) = "a" │ │ │ │ ├── closing_loc: (1,11)-(1,12) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (1,10)-(1,11)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (1,10)-(1,11)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: ∅ │ │ ├── opening_loc: ∅ @@ -69,7 +74,12 @@ │ │ │ │ ├── value_loc: (2,10)-(2,11) = "a" │ │ │ │ ├── closing_loc: (2,11)-(2,12) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (2,10)-(2,11)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (2,10)-(2,11)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: ∅ │ │ ├── opening_loc: ∅ @@ -105,7 +115,12 @@ │ │ │ │ ├── value_loc: (4,10)-(4,11) = "a" │ │ │ │ ├── closing_loc: (4,11)-(4,12) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (4,10)-(4,11)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (4,10)-(4,11)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: ∅ │ │ ├── opening_loc: ∅ @@ -141,7 +156,12 @@ │ │ │ ├── value_loc: (5,10)-(5,11) = "a" │ │ │ ├── closing_loc: (5,11)-(5,12) = ":" │ │ │ └── unescaped: "a" - │ │ ├── value: ∅ + │ │ ├── value: + │ │ │ @ ImplicitNode (location: (5,10)-(5,11)) + │ │ │ └── value: + │ │ │ @ LocalVariableTargetNode (location: (5,10)-(5,11)) + │ │ │ ├── name: :a + │ │ │ └── depth: 0 │ │ └── operator_loc: ∅ │ ├── rest: ∅ │ ├── opening_loc: ∅ diff --git a/test/prism/snapshots/whitequark/newline_in_hash_argument.txt b/test/prism/snapshots/whitequark/newline_in_hash_argument.txt index 4daf1ebce5..554d3108cd 100644 --- a/test/prism/snapshots/whitequark/newline_in_hash_argument.txt +++ b/test/prism/snapshots/whitequark/newline_in_hash_argument.txt @@ -29,7 +29,12 @@ │ │ │ │ │ │ ├── value_loc: (2,3)-(2,4) = "a" │ │ │ │ │ │ ├── closing_loc: (2,4)-(2,5) = ":" │ │ │ │ │ │ └── unescaped: "a" - │ │ │ │ │ ├── value: ∅ + │ │ │ │ │ ├── value: + │ │ │ │ │ │ @ ImplicitNode (location: (2,3)-(2,4)) + │ │ │ │ │ │ └── value: + │ │ │ │ │ │ @ LocalVariableTargetNode (location: (2,3)-(2,4)) + │ │ │ │ │ │ ├── name: :a + │ │ │ │ │ │ └── depth: 0 │ │ │ │ │ └── operator_loc: ∅ │ │ │ │ ├── rest: ∅ │ │ │ │ ├── opening_loc: ∅ @@ -55,7 +60,12 @@ │ │ │ │ │ ├── value_loc: (5,4)-(5,5) = "b" │ │ │ │ │ ├── closing_loc: (5,5)-(5,7) = "\":" │ │ │ │ │ └── unescaped: "b" - │ │ │ │ ├── value: ∅ + │ │ │ │ ├── value: + │ │ │ │ │ @ ImplicitNode (location: (5,4)-(5,5)) + │ │ │ │ │ └── value: + │ │ │ │ │ @ LocalVariableTargetNode (location: (5,4)-(5,5)) + │ │ │ │ │ ├── name: :b + │ │ │ │ │ └── depth: 0 │ │ │ │ └── operator_loc: ∅ │ │ │ ├── rest: ∅ │ │ │ ├── opening_loc: ∅ diff --git a/test/prism/snapshots/whitequark/pattern_matching_single_line_allowed_omission_of_parentheses.txt b/test/prism/snapshots/whitequark/pattern_matching_single_line_allowed_omission_of_parentheses.txt index dad320593a..99d1cdc25b 100644 --- a/test/prism/snapshots/whitequark/pattern_matching_single_line_allowed_omission_of_parentheses.txt +++ b/test/prism/snapshots/whitequark/pattern_matching_single_line_allowed_omission_of_parentheses.txt @@ -91,7 +91,12 @@ │ │ │ │ ├── value_loc: (5,10)-(5,11) = "a" │ │ │ │ ├── closing_loc: (5,11)-(5,12) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (5,10)-(5,11)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (5,10)-(5,11)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: ∅ │ │ ├── opening_loc: ∅ @@ -130,7 +135,12 @@ │ │ │ │ ├── value_loc: (7,10)-(7,11) = "a" │ │ │ │ ├── closing_loc: (7,11)-(7,12) = ":" │ │ │ │ └── unescaped: "a" - │ │ │ ├── value: ∅ + │ │ │ ├── value: + │ │ │ │ @ ImplicitNode (location: (7,10)-(7,11)) + │ │ │ │ └── value: + │ │ │ │ @ LocalVariableTargetNode (location: (7,10)-(7,11)) + │ │ │ │ ├── name: :a + │ │ │ │ └── depth: 0 │ │ │ └── operator_loc: ∅ │ │ ├── rest: ∅ │ │ ├── opening_loc: ∅ |