File tree Expand file tree Collapse file tree 3 files changed +74
-1
lines changed
Expand file tree Collapse file tree 3 files changed +74
-1
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,14 @@ std::unique_ptr<parser::Node> Translator::translate(pm_node_t *node) {
6666
6767 return make_unique<parser::Pair>(parser.translateLocation (loc), std::move (key), std::move (value));
6868 }
69+ case PM_ASSOC_SPLAT_NODE: {
70+ auto assocSplatNode = reinterpret_cast <pm_assoc_splat_node *>(node);
71+ pm_location_t *loc = &assocSplatNode->base .location ;
72+
73+ auto value = translate (assocSplatNode->value );
74+
75+ return make_unique<parser::Kwsplat>(parser.translateLocation (loc), std::move (value));
76+ }
6977 case PM_BEGIN_NODE: {
7078 auto beginNode = reinterpret_cast <pm_begin_node *>(node);
7179 auto loc = &beginNode->base .location ;
@@ -743,7 +751,6 @@ std::unique_ptr<parser::Node> Translator::translate(pm_node_t *node) {
743751 case PM_ALIAS_METHOD_NODE:
744752 case PM_ALTERNATION_PATTERN_NODE:
745753 case PM_ARRAY_PATTERN_NODE:
746- case PM_ASSOC_SPLAT_NODE:
747754 case PM_BACK_REFERENCE_READ_NODE:
748755 case PM_BLOCK_LOCAL_VARIABLE_NODE:
749756 case PM_CALL_AND_WRITE_NODE:
Original file line number Diff line number Diff line change 1+ Begin {
2+ stmts = [
3+ Hash {
4+ kwargs = false
5+ pairs = [
6+ Kwsplat {
7+ expr = Send {
8+ receiver = NULL
9+ method = <U foo>
10+ args = [
11+ ]
12+ }
13+ }
14+ ]
15+ }
16+ Hash {
17+ kwargs = false
18+ pairs = [
19+ Pair {
20+ key = Symbol {
21+ val = <U a>
22+ }
23+ value = Integer {
24+ val = "1"
25+ }
26+ }
27+ Kwsplat {
28+ expr = Send {
29+ receiver = NULL
30+ method = <U foo>
31+ args = [
32+ ]
33+ }
34+ }
35+ ]
36+ }
37+ Hash {
38+ kwargs = false
39+ pairs = [
40+ Kwsplat {
41+ expr = Send {
42+ receiver = NULL
43+ method = <U foo>
44+ args = [
45+ ]
46+ }
47+ }
48+ Pair {
49+ key = Symbol {
50+ val = <U a>
51+ }
52+ value = Integer {
53+ val = "1"
54+ }
55+ }
56+ ]
57+ }
58+ ]
59+ }
Original file line number Diff line number Diff line change 1+ # typed: false
2+
3+ { **foo }
4+
5+ # with other hash keys
6+ { a : 1 , **foo }
7+ { **foo , a : 1 }
You can’t perform that action at this time.
0 commit comments