ed-precompiled_prism 1.5.2-arm64-darwin
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.
- checksums.yaml +7 -0
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +723 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +58 -0
- data/LICENSE.md +7 -0
- data/Makefile +110 -0
- data/README.md +143 -0
- data/config.yml +4714 -0
- data/docs/build_system.md +119 -0
- data/docs/configuration.md +68 -0
- data/docs/cruby_compilation.md +27 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +121 -0
- data/docs/fuzzing.md +88 -0
- data/docs/heredocs.md +36 -0
- data/docs/javascript.md +118 -0
- data/docs/local_variable_depth.md +229 -0
- data/docs/mapping.md +117 -0
- data/docs/parser_translation.md +24 -0
- data/docs/parsing_rules.md +22 -0
- data/docs/releasing.md +98 -0
- data/docs/relocation.md +34 -0
- data/docs/ripper_translation.md +72 -0
- data/docs/ruby_api.md +44 -0
- data/docs/ruby_parser_translation.md +19 -0
- data/docs/serialization.md +233 -0
- data/docs/testing.md +55 -0
- data/ext/prism/api_node.c +6941 -0
- data/ext/prism/api_pack.c +276 -0
- data/ext/prism/extconf.rb +127 -0
- data/ext/prism/extension.c +1419 -0
- data/ext/prism/extension.h +19 -0
- data/include/prism/ast.h +8220 -0
- data/include/prism/defines.h +260 -0
- data/include/prism/diagnostic.h +456 -0
- data/include/prism/encoding.h +283 -0
- data/include/prism/node.h +129 -0
- data/include/prism/options.h +482 -0
- data/include/prism/pack.h +163 -0
- data/include/prism/parser.h +933 -0
- data/include/prism/prettyprint.h +34 -0
- data/include/prism/regexp.h +43 -0
- data/include/prism/static_literals.h +121 -0
- data/include/prism/util/pm_buffer.h +236 -0
- data/include/prism/util/pm_char.h +204 -0
- data/include/prism/util/pm_constant_pool.h +218 -0
- data/include/prism/util/pm_integer.h +130 -0
- data/include/prism/util/pm_list.h +103 -0
- data/include/prism/util/pm_memchr.h +29 -0
- data/include/prism/util/pm_newline_list.h +113 -0
- data/include/prism/util/pm_string.h +200 -0
- data/include/prism/util/pm_strncasecmp.h +32 -0
- data/include/prism/util/pm_strpbrk.h +46 -0
- data/include/prism/version.h +29 -0
- data/include/prism.h +408 -0
- data/lib/prism/3.0/prism.bundle +0 -0
- data/lib/prism/3.1/prism.bundle +0 -0
- data/lib/prism/3.2/prism.bundle +0 -0
- data/lib/prism/3.3/prism.bundle +0 -0
- data/lib/prism/3.4/prism.bundle +0 -0
- data/lib/prism/compiler.rb +801 -0
- data/lib/prism/desugar_compiler.rb +392 -0
- data/lib/prism/dispatcher.rb +2210 -0
- data/lib/prism/dot_visitor.rb +4762 -0
- data/lib/prism/dsl.rb +1003 -0
- data/lib/prism/ffi.rb +570 -0
- data/lib/prism/inspect_visitor.rb +2392 -0
- data/lib/prism/lex_compat.rb +928 -0
- data/lib/prism/mutation_compiler.rb +772 -0
- data/lib/prism/node.rb +18816 -0
- data/lib/prism/node_ext.rb +511 -0
- data/lib/prism/pack.rb +230 -0
- data/lib/prism/parse_result/comments.rb +188 -0
- data/lib/prism/parse_result/errors.rb +66 -0
- data/lib/prism/parse_result/newlines.rb +155 -0
- data/lib/prism/parse_result.rb +911 -0
- data/lib/prism/pattern.rb +269 -0
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/scan_byte.rb +14 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/polyfill/warn.rb +36 -0
- data/lib/prism/reflection.rb +416 -0
- data/lib/prism/relocation.rb +505 -0
- data/lib/prism/serialize.rb +2398 -0
- data/lib/prism/string_query.rb +31 -0
- data/lib/prism/translation/parser/builder.rb +62 -0
- data/lib/prism/translation/parser/compiler.rb +2234 -0
- data/lib/prism/translation/parser/lexer.rb +820 -0
- data/lib/prism/translation/parser.rb +374 -0
- data/lib/prism/translation/parser33.rb +13 -0
- data/lib/prism/translation/parser34.rb +13 -0
- data/lib/prism/translation/parser35.rb +13 -0
- data/lib/prism/translation/parser_current.rb +24 -0
- data/lib/prism/translation/ripper/sexp.rb +126 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3474 -0
- data/lib/prism/translation/ruby_parser.rb +1929 -0
- data/lib/prism/translation.rb +16 -0
- data/lib/prism/visitor.rb +813 -0
- data/lib/prism.rb +97 -0
- data/prism.gemspec +174 -0
- data/rbi/prism/compiler.rbi +12 -0
- data/rbi/prism/dsl.rbi +524 -0
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +8734 -0
- data/rbi/prism/node_ext.rbi +107 -0
- data/rbi/prism/parse_result.rbi +404 -0
- data/rbi/prism/reflection.rbi +58 -0
- data/rbi/prism/string_query.rbi +12 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser33.rbi +6 -0
- data/rbi/prism/translation/parser34.rbi +6 -0
- data/rbi/prism/translation/parser35.rbi +6 -0
- data/rbi/prism/translation/ripper.rbi +15 -0
- data/rbi/prism/visitor.rbi +473 -0
- data/rbi/prism.rbi +66 -0
- data/sig/prism/compiler.rbs +9 -0
- data/sig/prism/dispatcher.rbs +19 -0
- data/sig/prism/dot_visitor.rbs +6 -0
- data/sig/prism/dsl.rbs +351 -0
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +159 -0
- data/sig/prism/node.rbs +4028 -0
- data/sig/prism/node_ext.rbs +149 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result/comments.rbs +38 -0
- data/sig/prism/parse_result.rbs +196 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +50 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/serialize.rbs +8 -0
- data/sig/prism/string_query.rbs +11 -0
- data/sig/prism/visitor.rbs +169 -0
- data/sig/prism.rbs +254 -0
- data/src/diagnostic.c +850 -0
- data/src/encoding.c +5235 -0
- data/src/node.c +8676 -0
- data/src/options.c +328 -0
- data/src/pack.c +509 -0
- data/src/prettyprint.c +8941 -0
- data/src/prism.c +23361 -0
- data/src/regexp.c +790 -0
- data/src/serialize.c +2268 -0
- data/src/static_literals.c +617 -0
- data/src/token_type.c +703 -0
- data/src/util/pm_buffer.c +357 -0
- data/src/util/pm_char.c +318 -0
- data/src/util/pm_constant_pool.c +342 -0
- data/src/util/pm_integer.c +670 -0
- data/src/util/pm_list.c +49 -0
- data/src/util/pm_memchr.c +35 -0
- data/src/util/pm_newline_list.c +125 -0
- data/src/util/pm_string.c +381 -0
- data/src/util/pm_strncasecmp.c +36 -0
- data/src/util/pm_strpbrk.c +206 -0
- metadata +202 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# :markup: markdown
|
|
3
|
+
|
|
4
|
+
module Prism
|
|
5
|
+
class DesugarAndWriteNode # :nodoc:
|
|
6
|
+
include DSL
|
|
7
|
+
|
|
8
|
+
attr_reader :node, :default_source, :read_class, :write_class, :arguments
|
|
9
|
+
|
|
10
|
+
def initialize(node, default_source, read_class, write_class, **arguments)
|
|
11
|
+
@node = node
|
|
12
|
+
@default_source = default_source
|
|
13
|
+
@read_class = read_class
|
|
14
|
+
@write_class = write_class
|
|
15
|
+
@arguments = arguments
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Desugar `x &&= y` to `x && x = y`
|
|
19
|
+
def compile
|
|
20
|
+
and_node(
|
|
21
|
+
location: node.location,
|
|
22
|
+
left: public_send(read_class, location: node.name_loc, **arguments),
|
|
23
|
+
right: public_send(
|
|
24
|
+
write_class,
|
|
25
|
+
location: node.location,
|
|
26
|
+
**arguments,
|
|
27
|
+
name_loc: node.name_loc,
|
|
28
|
+
value: node.value,
|
|
29
|
+
operator_loc: node.operator_loc
|
|
30
|
+
),
|
|
31
|
+
operator_loc: node.operator_loc
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
class DesugarOrWriteDefinedNode # :nodoc:
|
|
37
|
+
include DSL
|
|
38
|
+
|
|
39
|
+
attr_reader :node, :default_source, :read_class, :write_class, :arguments
|
|
40
|
+
|
|
41
|
+
def initialize(node, default_source, read_class, write_class, **arguments)
|
|
42
|
+
@node = node
|
|
43
|
+
@default_source = default_source
|
|
44
|
+
@read_class = read_class
|
|
45
|
+
@write_class = write_class
|
|
46
|
+
@arguments = arguments
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Desugar `x ||= y` to `defined?(x) ? x : x = y`
|
|
50
|
+
def compile
|
|
51
|
+
if_node(
|
|
52
|
+
location: node.location,
|
|
53
|
+
if_keyword_loc: node.operator_loc,
|
|
54
|
+
predicate: defined_node(
|
|
55
|
+
location: node.name_loc,
|
|
56
|
+
value: public_send(read_class, location: node.name_loc, **arguments),
|
|
57
|
+
keyword_loc: node.operator_loc
|
|
58
|
+
),
|
|
59
|
+
then_keyword_loc: node.operator_loc,
|
|
60
|
+
statements: statements_node(
|
|
61
|
+
location: node.location,
|
|
62
|
+
body: [public_send(read_class, location: node.name_loc, **arguments)]
|
|
63
|
+
),
|
|
64
|
+
subsequent: else_node(
|
|
65
|
+
location: node.location,
|
|
66
|
+
else_keyword_loc: node.operator_loc,
|
|
67
|
+
statements: statements_node(
|
|
68
|
+
location: node.location,
|
|
69
|
+
body: [
|
|
70
|
+
public_send(
|
|
71
|
+
write_class,
|
|
72
|
+
location: node.location,
|
|
73
|
+
**arguments,
|
|
74
|
+
name_loc: node.name_loc,
|
|
75
|
+
value: node.value,
|
|
76
|
+
operator_loc: node.operator_loc
|
|
77
|
+
)
|
|
78
|
+
]
|
|
79
|
+
),
|
|
80
|
+
end_keyword_loc: node.operator_loc
|
|
81
|
+
),
|
|
82
|
+
end_keyword_loc: node.operator_loc
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
class DesugarOperatorWriteNode # :nodoc:
|
|
88
|
+
include DSL
|
|
89
|
+
|
|
90
|
+
attr_reader :node, :default_source, :read_class, :write_class, :arguments
|
|
91
|
+
|
|
92
|
+
def initialize(node, default_source, read_class, write_class, **arguments)
|
|
93
|
+
@node = node
|
|
94
|
+
@default_source = default_source
|
|
95
|
+
@read_class = read_class
|
|
96
|
+
@write_class = write_class
|
|
97
|
+
@arguments = arguments
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Desugar `x += y` to `x = x + y`
|
|
101
|
+
def compile
|
|
102
|
+
binary_operator_loc = node.binary_operator_loc.chop
|
|
103
|
+
|
|
104
|
+
public_send(
|
|
105
|
+
write_class,
|
|
106
|
+
location: node.location,
|
|
107
|
+
**arguments,
|
|
108
|
+
name_loc: node.name_loc,
|
|
109
|
+
value: call_node(
|
|
110
|
+
location: node.location,
|
|
111
|
+
receiver: public_send(
|
|
112
|
+
read_class,
|
|
113
|
+
location: node.name_loc,
|
|
114
|
+
**arguments
|
|
115
|
+
),
|
|
116
|
+
name: binary_operator_loc.slice.to_sym,
|
|
117
|
+
message_loc: binary_operator_loc,
|
|
118
|
+
arguments: arguments_node(
|
|
119
|
+
location: node.value.location,
|
|
120
|
+
arguments: [node.value]
|
|
121
|
+
)
|
|
122
|
+
),
|
|
123
|
+
operator_loc: node.binary_operator_loc.copy(
|
|
124
|
+
start_offset: node.binary_operator_loc.end_offset - 1,
|
|
125
|
+
length: 1
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
class DesugarOrWriteNode # :nodoc:
|
|
132
|
+
include DSL
|
|
133
|
+
|
|
134
|
+
attr_reader :node, :default_source, :read_class, :write_class, :arguments
|
|
135
|
+
|
|
136
|
+
def initialize(node, default_source, read_class, write_class, **arguments)
|
|
137
|
+
@node = node
|
|
138
|
+
@default_source = default_source
|
|
139
|
+
@read_class = read_class
|
|
140
|
+
@write_class = write_class
|
|
141
|
+
@arguments = arguments
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Desugar `x ||= y` to `x || x = y`
|
|
145
|
+
def compile
|
|
146
|
+
or_node(
|
|
147
|
+
location: node.location,
|
|
148
|
+
left: public_send(read_class, location: node.name_loc, **arguments),
|
|
149
|
+
right: public_send(
|
|
150
|
+
write_class,
|
|
151
|
+
location: node.location,
|
|
152
|
+
**arguments,
|
|
153
|
+
name_loc: node.name_loc,
|
|
154
|
+
value: node.value,
|
|
155
|
+
operator_loc: node.operator_loc
|
|
156
|
+
),
|
|
157
|
+
operator_loc: node.operator_loc
|
|
158
|
+
)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
private_constant :DesugarAndWriteNode, :DesugarOrWriteNode, :DesugarOrWriteDefinedNode, :DesugarOperatorWriteNode
|
|
163
|
+
|
|
164
|
+
class ClassVariableAndWriteNode
|
|
165
|
+
def desugar # :nodoc:
|
|
166
|
+
DesugarAndWriteNode.new(self, source, :class_variable_read_node, :class_variable_write_node, name: name).compile
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
class ClassVariableOrWriteNode
|
|
171
|
+
def desugar # :nodoc:
|
|
172
|
+
DesugarOrWriteDefinedNode.new(self, source, :class_variable_read_node, :class_variable_write_node, name: name).compile
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class ClassVariableOperatorWriteNode
|
|
177
|
+
def desugar # :nodoc:
|
|
178
|
+
DesugarOperatorWriteNode.new(self, source, :class_variable_read_node, :class_variable_write_node, name: name).compile
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
class ConstantAndWriteNode
|
|
183
|
+
def desugar # :nodoc:
|
|
184
|
+
DesugarAndWriteNode.new(self, source, :constant_read_node, :constant_write_node, name: name).compile
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
class ConstantOrWriteNode
|
|
189
|
+
def desugar # :nodoc:
|
|
190
|
+
DesugarOrWriteDefinedNode.new(self, source, :constant_read_node, :constant_write_node, name: name).compile
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
class ConstantOperatorWriteNode
|
|
195
|
+
def desugar # :nodoc:
|
|
196
|
+
DesugarOperatorWriteNode.new(self, source, :constant_read_node, :constant_write_node, name: name).compile
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
class GlobalVariableAndWriteNode
|
|
201
|
+
def desugar # :nodoc:
|
|
202
|
+
DesugarAndWriteNode.new(self, source, :global_variable_read_node, :global_variable_write_node, name: name).compile
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
class GlobalVariableOrWriteNode
|
|
207
|
+
def desugar # :nodoc:
|
|
208
|
+
DesugarOrWriteDefinedNode.new(self, source, :global_variable_read_node, :global_variable_write_node, name: name).compile
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
class GlobalVariableOperatorWriteNode
|
|
213
|
+
def desugar # :nodoc:
|
|
214
|
+
DesugarOperatorWriteNode.new(self, source, :global_variable_read_node, :global_variable_write_node, name: name).compile
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
class InstanceVariableAndWriteNode
|
|
219
|
+
def desugar # :nodoc:
|
|
220
|
+
DesugarAndWriteNode.new(self, source, :instance_variable_read_node, :instance_variable_write_node, name: name).compile
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
class InstanceVariableOrWriteNode
|
|
225
|
+
def desugar # :nodoc:
|
|
226
|
+
DesugarOrWriteNode.new(self, source, :instance_variable_read_node, :instance_variable_write_node, name: name).compile
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
class InstanceVariableOperatorWriteNode
|
|
231
|
+
def desugar # :nodoc:
|
|
232
|
+
DesugarOperatorWriteNode.new(self, source, :instance_variable_read_node, :instance_variable_write_node, name: name).compile
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
class LocalVariableAndWriteNode
|
|
237
|
+
def desugar # :nodoc:
|
|
238
|
+
DesugarAndWriteNode.new(self, source, :local_variable_read_node, :local_variable_write_node, name: name, depth: depth).compile
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
class LocalVariableOrWriteNode
|
|
243
|
+
def desugar # :nodoc:
|
|
244
|
+
DesugarOrWriteNode.new(self, source, :local_variable_read_node, :local_variable_write_node, name: name, depth: depth).compile
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
class LocalVariableOperatorWriteNode
|
|
249
|
+
def desugar # :nodoc:
|
|
250
|
+
DesugarOperatorWriteNode.new(self, source, :local_variable_read_node, :local_variable_write_node, name: name, depth: depth).compile
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# DesugarCompiler is a compiler that desugars Ruby code into a more primitive
|
|
255
|
+
# form. This is useful for consumers that want to deal with fewer node types.
|
|
256
|
+
class DesugarCompiler < MutationCompiler
|
|
257
|
+
# @@foo &&= bar
|
|
258
|
+
#
|
|
259
|
+
# becomes
|
|
260
|
+
#
|
|
261
|
+
# @@foo && @@foo = bar
|
|
262
|
+
def visit_class_variable_and_write_node(node)
|
|
263
|
+
node.desugar
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# @@foo ||= bar
|
|
267
|
+
#
|
|
268
|
+
# becomes
|
|
269
|
+
#
|
|
270
|
+
# defined?(@@foo) ? @@foo : @@foo = bar
|
|
271
|
+
def visit_class_variable_or_write_node(node)
|
|
272
|
+
node.desugar
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# @@foo += bar
|
|
276
|
+
#
|
|
277
|
+
# becomes
|
|
278
|
+
#
|
|
279
|
+
# @@foo = @@foo + bar
|
|
280
|
+
def visit_class_variable_operator_write_node(node)
|
|
281
|
+
node.desugar
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Foo &&= bar
|
|
285
|
+
#
|
|
286
|
+
# becomes
|
|
287
|
+
#
|
|
288
|
+
# Foo && Foo = bar
|
|
289
|
+
def visit_constant_and_write_node(node)
|
|
290
|
+
node.desugar
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# Foo ||= bar
|
|
294
|
+
#
|
|
295
|
+
# becomes
|
|
296
|
+
#
|
|
297
|
+
# defined?(Foo) ? Foo : Foo = bar
|
|
298
|
+
def visit_constant_or_write_node(node)
|
|
299
|
+
node.desugar
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Foo += bar
|
|
303
|
+
#
|
|
304
|
+
# becomes
|
|
305
|
+
#
|
|
306
|
+
# Foo = Foo + bar
|
|
307
|
+
def visit_constant_operator_write_node(node)
|
|
308
|
+
node.desugar
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
# $foo &&= bar
|
|
312
|
+
#
|
|
313
|
+
# becomes
|
|
314
|
+
#
|
|
315
|
+
# $foo && $foo = bar
|
|
316
|
+
def visit_global_variable_and_write_node(node)
|
|
317
|
+
node.desugar
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# $foo ||= bar
|
|
321
|
+
#
|
|
322
|
+
# becomes
|
|
323
|
+
#
|
|
324
|
+
# defined?($foo) ? $foo : $foo = bar
|
|
325
|
+
def visit_global_variable_or_write_node(node)
|
|
326
|
+
node.desugar
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
# $foo += bar
|
|
330
|
+
#
|
|
331
|
+
# becomes
|
|
332
|
+
#
|
|
333
|
+
# $foo = $foo + bar
|
|
334
|
+
def visit_global_variable_operator_write_node(node)
|
|
335
|
+
node.desugar
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
# @foo &&= bar
|
|
339
|
+
#
|
|
340
|
+
# becomes
|
|
341
|
+
#
|
|
342
|
+
# @foo && @foo = bar
|
|
343
|
+
def visit_instance_variable_and_write_node(node)
|
|
344
|
+
node.desugar
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# @foo ||= bar
|
|
348
|
+
#
|
|
349
|
+
# becomes
|
|
350
|
+
#
|
|
351
|
+
# @foo || @foo = bar
|
|
352
|
+
def visit_instance_variable_or_write_node(node)
|
|
353
|
+
node.desugar
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
# @foo += bar
|
|
357
|
+
#
|
|
358
|
+
# becomes
|
|
359
|
+
#
|
|
360
|
+
# @foo = @foo + bar
|
|
361
|
+
def visit_instance_variable_operator_write_node(node)
|
|
362
|
+
node.desugar
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# foo &&= bar
|
|
366
|
+
#
|
|
367
|
+
# becomes
|
|
368
|
+
#
|
|
369
|
+
# foo && foo = bar
|
|
370
|
+
def visit_local_variable_and_write_node(node)
|
|
371
|
+
node.desugar
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
# foo ||= bar
|
|
375
|
+
#
|
|
376
|
+
# becomes
|
|
377
|
+
#
|
|
378
|
+
# foo || foo = bar
|
|
379
|
+
def visit_local_variable_or_write_node(node)
|
|
380
|
+
node.desugar
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
# foo += bar
|
|
384
|
+
#
|
|
385
|
+
# becomes
|
|
386
|
+
#
|
|
387
|
+
# foo = foo + bar
|
|
388
|
+
def visit_local_variable_operator_write_node(node)
|
|
389
|
+
node.desugar
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
end
|