syntax_tree 5.1.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,6 +34,14 @@ module SyntaxTree
34
34
  [:getclassvariable, name]
35
35
  end
36
36
 
37
+ def deconstruct_keys(_keys)
38
+ { name: name }
39
+ end
40
+
41
+ def ==(other)
42
+ other.is_a?(GetClassVariable) && other.name == name
43
+ end
44
+
37
45
  def length
38
46
  2
39
47
  end
@@ -45,6 +53,14 @@ module SyntaxTree
45
53
  def pushes
46
54
  1
47
55
  end
56
+
57
+ def canonical
58
+ YARV::GetClassVariable.new(name, nil)
59
+ end
60
+
61
+ def call(vm)
62
+ canonical.call(vm)
63
+ end
48
64
  end
49
65
 
50
66
  # ### Summary
@@ -82,6 +98,15 @@ module SyntaxTree
82
98
  [:opt_getinlinecache, label.name, cache]
83
99
  end
84
100
 
101
+ def deconstruct_keys(_keys)
102
+ { label: label, cache: cache }
103
+ end
104
+
105
+ def ==(other)
106
+ other.is_a?(OptGetInlineCache) && other.label == label &&
107
+ other.cache == cache
108
+ end
109
+
85
110
  def length
86
111
  3
87
112
  end
@@ -94,6 +119,10 @@ module SyntaxTree
94
119
  1
95
120
  end
96
121
 
122
+ def canonical
123
+ self
124
+ end
125
+
97
126
  def call(vm)
98
127
  vm.push(nil)
99
128
  end
@@ -102,8 +131,8 @@ module SyntaxTree
102
131
  # ### Summary
103
132
  #
104
133
  # `opt_setinlinecache` sets an inline cache for a constant lookup. It pops
105
- # the value it should set off the top of the stack. It then pushes that
106
- # value back onto the top of the stack.
134
+ # the value it should set off the top of the stack. It uses this value to
135
+ # set the cache. It then pushes that value back onto the top of the stack.
107
136
  #
108
137
  # This instruction is no longer used since in Ruby 3.2 it was replaced by
109
138
  # the consolidated `opt_getconstant_path` instruction.
@@ -129,6 +158,14 @@ module SyntaxTree
129
158
  [:opt_setinlinecache, cache]
130
159
  end
131
160
 
161
+ def deconstruct_keys(_keys)
162
+ { cache: cache }
163
+ end
164
+
165
+ def ==(other)
166
+ other.is_a?(OptSetInlineCache) && other.cache == cache
167
+ end
168
+
132
169
  def length
133
170
  2
134
171
  end
@@ -141,8 +178,11 @@ module SyntaxTree
141
178
  1
142
179
  end
143
180
 
181
+ def canonical
182
+ self
183
+ end
184
+
144
185
  def call(vm)
145
- vm.push(vm.pop)
146
186
  end
147
187
  end
148
188
 
@@ -175,6 +215,14 @@ module SyntaxTree
175
215
  [:setclassvariable, name]
176
216
  end
177
217
 
218
+ def deconstruct_keys(_keys)
219
+ { name: name }
220
+ end
221
+
222
+ def ==(other)
223
+ other.is_a?(SetClassVariable) && other.name == name
224
+ end
225
+
178
226
  def length
179
227
  2
180
228
  end
@@ -186,6 +234,14 @@ module SyntaxTree
186
234
  def pushes
187
235
  0
188
236
  end
237
+
238
+ def canonical
239
+ YARV::SetClassVariable.new(name, nil)
240
+ end
241
+
242
+ def call(vm)
243
+ canonical.call(vm)
244
+ end
189
245
  end
190
246
  end
191
247
  end