prism 0.28.0 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -1
- data/CONTRIBUTING.md +0 -4
- data/README.md +1 -0
- data/config.yml +95 -26
- data/docs/fuzzing.md +1 -1
- data/docs/ripper_translation.md +22 -0
- data/ext/prism/api_node.c +70 -52
- data/ext/prism/extconf.rb +27 -23
- data/ext/prism/extension.c +107 -372
- data/ext/prism/extension.h +1 -1
- data/include/prism/ast.h +170 -102
- data/include/prism/diagnostic.h +18 -3
- data/include/prism/node.h +0 -21
- data/include/prism/parser.h +23 -25
- data/include/prism/regexp.h +17 -8
- data/include/prism/static_literals.h +3 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +0 -8
- data/include/prism/util/pm_integer.h +16 -9
- data/include/prism/util/pm_string.h +0 -8
- data/include/prism/version.h +2 -2
- data/include/prism.h +0 -11
- data/lib/prism/compiler.rb +3 -0
- data/lib/prism/desugar_compiler.rb +4 -4
- data/lib/prism/dispatcher.rb +14 -0
- data/lib/prism/dot_visitor.rb +54 -35
- data/lib/prism/dsl.rb +23 -18
- data/lib/prism/ffi.rb +25 -4
- data/lib/prism/inspect_visitor.rb +26 -24
- data/lib/prism/mutation_compiler.rb +6 -1
- data/lib/prism/node.rb +314 -389
- data/lib/prism/node_ext.rb +175 -17
- data/lib/prism/parse_result/comments.rb +1 -8
- data/lib/prism/parse_result/newlines.rb +102 -12
- data/lib/prism/parse_result.rb +17 -0
- data/lib/prism/reflection.rb +11 -9
- data/lib/prism/serialize.rb +91 -68
- data/lib/prism/translation/parser/compiler.rb +288 -138
- data/lib/prism/translation/parser.rb +7 -2
- data/lib/prism/translation/ripper.rb +24 -22
- data/lib/prism/translation/ruby_parser.rb +32 -14
- data/lib/prism/visitor.rb +3 -0
- data/lib/prism.rb +0 -4
- data/prism.gemspec +2 -4
- data/rbi/prism/node.rbi +114 -57
- data/rbi/prism/node_ext.rbi +5 -0
- data/rbi/prism/parse_result.rbi +1 -1
- data/rbi/prism/visitor.rbi +3 -0
- data/rbi/prism.rbi +6 -0
- data/sig/prism/dsl.rbs +13 -10
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +1 -0
- data/sig/prism/node.rbs +72 -48
- data/sig/prism/node_ext.rbs +4 -0
- data/sig/prism/visitor.rbs +1 -0
- data/sig/prism.rbs +21 -0
- data/src/diagnostic.c +56 -27
- data/src/node.c +432 -1690
- data/src/prettyprint.c +97 -54
- data/src/prism.c +1286 -1196
- data/src/regexp.c +133 -68
- data/src/serialize.c +22 -17
- data/src/static_literals.c +63 -84
- data/src/token_type.c +4 -4
- data/src/util/pm_constant_pool.c +0 -8
- data/src/util/pm_integer.c +39 -11
- data/src/util/pm_string.c +0 -12
- data/src/util/pm_strpbrk.c +32 -6
- metadata +3 -5
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -249
- data/src/util/pm_string_list.c +0 -28
data/lib/prism/node_ext.rb
CHANGED
@@ -3,6 +3,20 @@
|
|
3
3
|
# Here we are reopening the prism module to provide methods on nodes that aren't
|
4
4
|
# templated and are meant as convenience methods.
|
5
5
|
module Prism
|
6
|
+
class Node
|
7
|
+
def deprecated(*replacements) # :nodoc:
|
8
|
+
location = caller_locations(1, 1)
|
9
|
+
location = location[0].label if location
|
10
|
+
suggest = replacements.map { |replacement| "#{self.class}##{replacement}" }
|
11
|
+
|
12
|
+
warn(<<~MSG, category: :deprecated)
|
13
|
+
[deprecation]: #{self.class}##{location} is deprecated and will be \
|
14
|
+
removed in the next major version. Use #{suggest.join("/")} instead.
|
15
|
+
#{(caller(1, 3) || []).join("\n")}
|
16
|
+
MSG
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
module RegularExpressionOptions # :nodoc:
|
7
21
|
# Returns a numeric value that represents the flags that were used to create
|
8
22
|
# the regular expression.
|
@@ -92,7 +106,19 @@ module Prism
|
|
92
106
|
class RationalNode < Node
|
93
107
|
# Returns the value of the node as a Ruby Rational.
|
94
108
|
def value
|
95
|
-
Rational(
|
109
|
+
Rational(numerator, denominator)
|
110
|
+
end
|
111
|
+
|
112
|
+
# Returns the value of the node as an IntegerNode or a FloatNode. This
|
113
|
+
# method is deprecated in favor of #value or #numerator/#denominator.
|
114
|
+
def numeric
|
115
|
+
deprecated("value", "numerator", "denominator")
|
116
|
+
|
117
|
+
if denominator == 1
|
118
|
+
IntegerNode.new(source, flags, numerator, location.chop)
|
119
|
+
else
|
120
|
+
FloatNode.new(source, numerator.to_f / denominator, location.chop)
|
121
|
+
end
|
96
122
|
end
|
97
123
|
end
|
98
124
|
|
@@ -168,13 +194,7 @@ module Prism
|
|
168
194
|
# constant read or a missing node. To not cause a breaking change, we
|
169
195
|
# continue to supply that API.
|
170
196
|
def child
|
171
|
-
|
172
|
-
DEPRECATED: ConstantPathNode#child is deprecated and will be removed \
|
173
|
-
in the next major version. Use \
|
174
|
-
ConstantPathNode#name/ConstantPathNode#name_loc instead. Called from \
|
175
|
-
#{caller(1, 1)&.first}.
|
176
|
-
MSG
|
177
|
-
|
197
|
+
deprecated("name", "name_loc")
|
178
198
|
name ? ConstantReadNode.new(source, name, name_loc) : MissingNode.new(source, location)
|
179
199
|
end
|
180
200
|
end
|
@@ -210,13 +230,7 @@ module Prism
|
|
210
230
|
# constant read or a missing node. To not cause a breaking change, we
|
211
231
|
# continue to supply that API.
|
212
232
|
def child
|
213
|
-
|
214
|
-
DEPRECATED: ConstantPathTargetNode#child is deprecated and will be \
|
215
|
-
removed in the next major version. Use \
|
216
|
-
ConstantPathTargetNode#name/ConstantPathTargetNode#name_loc instead. \
|
217
|
-
Called from #{caller(1, 1)&.first}.
|
218
|
-
MSG
|
219
|
-
|
233
|
+
deprecated("name", "name_loc")
|
220
234
|
name ? ConstantReadNode.new(source, name, name_loc) : MissingNode.new(source, location)
|
221
235
|
end
|
222
236
|
end
|
@@ -250,9 +264,10 @@ module Prism
|
|
250
264
|
end
|
251
265
|
|
252
266
|
posts.each do |param|
|
253
|
-
|
267
|
+
case param
|
268
|
+
when MultiTargetNode
|
254
269
|
names << [:req]
|
255
|
-
|
270
|
+
when NoKeywordsParameterNode, KeywordRestParameterNode, ForwardingParameterNode
|
256
271
|
# Invalid syntax, e.g. "def f(**nil, ...)" moves the NoKeywordsParameterNode to posts
|
257
272
|
raise "Invalid syntax"
|
258
273
|
else
|
@@ -286,4 +301,147 @@ module Prism
|
|
286
301
|
names
|
287
302
|
end
|
288
303
|
end
|
304
|
+
|
305
|
+
class CallNode < Node
|
306
|
+
# When a call node has the attribute_write flag set, it means that the call
|
307
|
+
# is using the attribute write syntax. This is either a method call to []=
|
308
|
+
# or a method call to a method that ends with =. Either way, the = sign is
|
309
|
+
# present in the source.
|
310
|
+
#
|
311
|
+
# Prism returns the message_loc _without_ the = sign attached, because there
|
312
|
+
# can be any amount of space between the message and the = sign. However,
|
313
|
+
# sometimes you want the location of the full message including the inner
|
314
|
+
# space and the = sign. This method provides that.
|
315
|
+
def full_message_loc
|
316
|
+
attribute_write? ? message_loc&.adjoin("=") : message_loc
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
class CallOperatorWriteNode < Node
|
321
|
+
# Returns the binary operator used to modify the receiver. This method is
|
322
|
+
# deprecated in favor of #binary_operator.
|
323
|
+
def operator
|
324
|
+
deprecated("binary_operator")
|
325
|
+
binary_operator
|
326
|
+
end
|
327
|
+
|
328
|
+
# Returns the location of the binary operator used to modify the receiver.
|
329
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
330
|
+
def operator_loc
|
331
|
+
deprecated("binary_operator_loc")
|
332
|
+
binary_operator_loc
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
class ClassVariableOperatorWriteNode < Node
|
337
|
+
# Returns the binary operator used to modify the receiver. This method is
|
338
|
+
# deprecated in favor of #binary_operator.
|
339
|
+
def operator
|
340
|
+
deprecated("binary_operator")
|
341
|
+
binary_operator
|
342
|
+
end
|
343
|
+
|
344
|
+
# Returns the location of the binary operator used to modify the receiver.
|
345
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
346
|
+
def operator_loc
|
347
|
+
deprecated("binary_operator_loc")
|
348
|
+
binary_operator_loc
|
349
|
+
end
|
350
|
+
end
|
351
|
+
|
352
|
+
class ConstantOperatorWriteNode < Node
|
353
|
+
# Returns the binary operator used to modify the receiver. This method is
|
354
|
+
# deprecated in favor of #binary_operator.
|
355
|
+
def operator
|
356
|
+
deprecated("binary_operator")
|
357
|
+
binary_operator
|
358
|
+
end
|
359
|
+
|
360
|
+
# Returns the location of the binary operator used to modify the receiver.
|
361
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
362
|
+
def operator_loc
|
363
|
+
deprecated("binary_operator_loc")
|
364
|
+
binary_operator_loc
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
class ConstantPathOperatorWriteNode < Node
|
369
|
+
# Returns the binary operator used to modify the receiver. This method is
|
370
|
+
# deprecated in favor of #binary_operator.
|
371
|
+
def operator
|
372
|
+
deprecated("binary_operator")
|
373
|
+
binary_operator
|
374
|
+
end
|
375
|
+
|
376
|
+
# Returns the location of the binary operator used to modify the receiver.
|
377
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
378
|
+
def operator_loc
|
379
|
+
deprecated("binary_operator_loc")
|
380
|
+
binary_operator_loc
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
class GlobalVariableOperatorWriteNode < Node
|
385
|
+
# Returns the binary operator used to modify the receiver. This method is
|
386
|
+
# deprecated in favor of #binary_operator.
|
387
|
+
def operator
|
388
|
+
deprecated("binary_operator")
|
389
|
+
binary_operator
|
390
|
+
end
|
391
|
+
|
392
|
+
# Returns the location of the binary operator used to modify the receiver.
|
393
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
394
|
+
def operator_loc
|
395
|
+
deprecated("binary_operator_loc")
|
396
|
+
binary_operator_loc
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
class IndexOperatorWriteNode < Node
|
401
|
+
# Returns the binary operator used to modify the receiver. This method is
|
402
|
+
# deprecated in favor of #binary_operator.
|
403
|
+
def operator
|
404
|
+
deprecated("binary_operator")
|
405
|
+
binary_operator
|
406
|
+
end
|
407
|
+
|
408
|
+
# Returns the location of the binary operator used to modify the receiver.
|
409
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
410
|
+
def operator_loc
|
411
|
+
deprecated("binary_operator_loc")
|
412
|
+
binary_operator_loc
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
class InstanceVariableOperatorWriteNode < Node
|
417
|
+
# Returns the binary operator used to modify the receiver. This method is
|
418
|
+
# deprecated in favor of #binary_operator.
|
419
|
+
def operator
|
420
|
+
deprecated("binary_operator")
|
421
|
+
binary_operator
|
422
|
+
end
|
423
|
+
|
424
|
+
# Returns the location of the binary operator used to modify the receiver.
|
425
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
426
|
+
def operator_loc
|
427
|
+
deprecated("binary_operator_loc")
|
428
|
+
binary_operator_loc
|
429
|
+
end
|
430
|
+
end
|
431
|
+
|
432
|
+
class LocalVariableOperatorWriteNode < Node
|
433
|
+
# Returns the binary operator used to modify the receiver. This method is
|
434
|
+
# deprecated in favor of #binary_operator.
|
435
|
+
def operator
|
436
|
+
deprecated("binary_operator")
|
437
|
+
binary_operator
|
438
|
+
end
|
439
|
+
|
440
|
+
# Returns the location of the binary operator used to modify the receiver.
|
441
|
+
# This method is deprecated in favor of #binary_operator_loc.
|
442
|
+
def operator_loc
|
443
|
+
deprecated("binary_operator_loc")
|
444
|
+
binary_operator_loc
|
445
|
+
end
|
446
|
+
end
|
289
447
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Prism
|
4
|
-
class ParseResult
|
4
|
+
class ParseResult < Result
|
5
5
|
# When we've parsed the source, we have both the syntax tree and the list of
|
6
6
|
# comments that we found in the source. This class is responsible for
|
7
7
|
# walking the tree and finding the nearest location to attach each comment.
|
@@ -183,12 +183,5 @@ module Prism
|
|
183
183
|
[preceding, NodeTarget.new(node), following]
|
184
184
|
end
|
185
185
|
end
|
186
|
-
|
187
|
-
private_constant :Comments
|
188
|
-
|
189
|
-
# Attach the list of comments to their respective locations in the tree.
|
190
|
-
def attach_comments!
|
191
|
-
Comments.new(self).attach! # steep:ignore
|
192
|
-
end
|
193
186
|
end
|
194
187
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Prism
|
4
|
-
class ParseResult
|
4
|
+
class ParseResult < Result
|
5
5
|
# The :line tracepoint event gets fired whenever the Ruby VM encounters an
|
6
6
|
# expression on a new line. The types of expressions that can trigger this
|
7
7
|
# event are:
|
@@ -17,21 +17,27 @@ module Prism
|
|
17
17
|
# Note that the logic in this file should be kept in sync with the Java
|
18
18
|
# MarkNewlinesVisitor, since that visitor is responsible for marking the
|
19
19
|
# newlines for JRuby/TruffleRuby.
|
20
|
+
#
|
21
|
+
# This file is autoloaded only when `mark_newlines!` is called, so the
|
22
|
+
# re-opening of the various nodes in this file will only be performed in
|
23
|
+
# that case. We do that to avoid storing the extra `@newline` instance
|
24
|
+
# variable on every node if we don't need it.
|
20
25
|
class Newlines < Visitor
|
21
26
|
# Create a new Newlines visitor with the given newline offsets.
|
22
|
-
def initialize(
|
23
|
-
@
|
27
|
+
def initialize(lines)
|
28
|
+
# @type var lines: Integer
|
29
|
+
@lines = Array.new(1 + lines, false)
|
24
30
|
end
|
25
31
|
|
26
32
|
# Permit block/lambda nodes to mark newlines within themselves.
|
27
33
|
def visit_block_node(node)
|
28
|
-
|
29
|
-
@
|
34
|
+
old_lines = @lines
|
35
|
+
@lines = Array.new(old_lines.size, false)
|
30
36
|
|
31
37
|
begin
|
32
38
|
super(node)
|
33
39
|
ensure
|
34
|
-
@
|
40
|
+
@lines = old_lines
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
@@ -39,7 +45,7 @@ module Prism
|
|
39
45
|
|
40
46
|
# Mark if/unless nodes as newlines.
|
41
47
|
def visit_if_node(node)
|
42
|
-
node.
|
48
|
+
node.newline!(@lines)
|
43
49
|
super(node)
|
44
50
|
end
|
45
51
|
|
@@ -48,17 +54,101 @@ module Prism
|
|
48
54
|
# Permit statements lists to mark newlines within themselves.
|
49
55
|
def visit_statements_node(node)
|
50
56
|
node.body.each do |child|
|
51
|
-
child.
|
57
|
+
child.newline!(@lines)
|
52
58
|
end
|
53
59
|
super(node)
|
54
60
|
end
|
55
61
|
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class Node
|
65
|
+
def newline? # :nodoc:
|
66
|
+
@newline ? true : false
|
67
|
+
end
|
68
|
+
|
69
|
+
def newline!(lines) # :nodoc:
|
70
|
+
line = location.start_line
|
71
|
+
unless lines[line]
|
72
|
+
lines[line] = true
|
73
|
+
@newline = true
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
class BeginNode < Node
|
79
|
+
def newline!(lines) # :nodoc:
|
80
|
+
# Never mark BeginNode with a newline flag, mark children instead.
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class ParenthesesNode < Node
|
85
|
+
def newline!(lines) # :nodoc:
|
86
|
+
# Never mark ParenthesesNode with a newline flag, mark children instead.
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class IfNode < Node
|
91
|
+
def newline!(lines) # :nodoc:
|
92
|
+
predicate.newline!(lines)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
class UnlessNode < Node
|
97
|
+
def newline!(lines) # :nodoc:
|
98
|
+
predicate.newline!(lines)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class UntilNode < Node
|
103
|
+
def newline!(lines) # :nodoc:
|
104
|
+
predicate.newline!(lines)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
class WhileNode < Node
|
109
|
+
def newline!(lines) # :nodoc:
|
110
|
+
predicate.newline!(lines)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
class RescueModifierNode < Node
|
115
|
+
def newline!(lines) # :nodoc:
|
116
|
+
expression.newline!(lines)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class InterpolatedMatchLastLineNode < Node
|
121
|
+
def newline!(lines) # :nodoc:
|
122
|
+
first = parts.first
|
123
|
+
first.newline!(lines) if first
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class InterpolatedRegularExpressionNode < Node
|
128
|
+
def newline!(lines) # :nodoc:
|
129
|
+
first = parts.first
|
130
|
+
first.newline!(lines) if first
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
class InterpolatedStringNode < Node
|
135
|
+
def newline!(lines) # :nodoc:
|
136
|
+
first = parts.first
|
137
|
+
first.newline!(lines) if first
|
138
|
+
end
|
139
|
+
end
|
56
140
|
|
57
|
-
|
141
|
+
class InterpolatedSymbolNode < Node
|
142
|
+
def newline!(lines) # :nodoc:
|
143
|
+
first = parts.first
|
144
|
+
first.newline!(lines) if first
|
145
|
+
end
|
146
|
+
end
|
58
147
|
|
59
|
-
|
60
|
-
def
|
61
|
-
|
148
|
+
class InterpolatedXStringNode < Node
|
149
|
+
def newline!(lines) # :nodoc:
|
150
|
+
first = parts.first
|
151
|
+
first.newline!(lines) if first
|
62
152
|
end
|
63
153
|
end
|
64
154
|
end
|
data/lib/prism/parse_result.rb
CHANGED
@@ -574,6 +574,12 @@ module Prism
|
|
574
574
|
|
575
575
|
# This is a result specific to the `parse` and `parse_file` methods.
|
576
576
|
class ParseResult < Result
|
577
|
+
autoload :Comments, "prism/parse_result/comments"
|
578
|
+
autoload :Newlines, "prism/parse_result/newlines"
|
579
|
+
|
580
|
+
private_constant :Comments
|
581
|
+
private_constant :Newlines
|
582
|
+
|
577
583
|
# The syntax tree that was parsed from the source code.
|
578
584
|
attr_reader :value
|
579
585
|
|
@@ -587,6 +593,17 @@ module Prism
|
|
587
593
|
def deconstruct_keys(keys)
|
588
594
|
super.merge!(value: value)
|
589
595
|
end
|
596
|
+
|
597
|
+
# Attach the list of comments to their respective locations in the tree.
|
598
|
+
def attach_comments!
|
599
|
+
Comments.new(self).attach! # steep:ignore
|
600
|
+
end
|
601
|
+
|
602
|
+
# Walk the tree and mark nodes that are on a new line, loosely emulating
|
603
|
+
# the behavior of CRuby's `:line` tracepoint event.
|
604
|
+
def mark_newlines!
|
605
|
+
value.accept(Newlines.new(source.offsets.size)) # steep:ignore
|
606
|
+
end
|
590
607
|
end
|
591
608
|
|
592
609
|
# This is a result specific to the `lex` and `lex_file` methods.
|
data/lib/prism/reflection.rb
CHANGED
@@ -142,7 +142,7 @@ module Prism
|
|
142
142
|
when :call_node
|
143
143
|
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), ConstantField.new(:name), OptionalLocationField.new(:message_loc), OptionalLocationField.new(:opening_loc), OptionalNodeField.new(:arguments), OptionalLocationField.new(:closing_loc), OptionalNodeField.new(:block)]
|
144
144
|
when :call_operator_write_node
|
145
|
-
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), OptionalLocationField.new(:message_loc), ConstantField.new(:read_name), ConstantField.new(:write_name), ConstantField.new(:
|
145
|
+
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), OptionalLocationField.new(:message_loc), ConstantField.new(:read_name), ConstantField.new(:write_name), ConstantField.new(:binary_operator), LocationField.new(:binary_operator_loc), NodeField.new(:value)]
|
146
146
|
when :call_or_write_node
|
147
147
|
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), OptionalLocationField.new(:message_loc), ConstantField.new(:read_name), ConstantField.new(:write_name), LocationField.new(:operator_loc), NodeField.new(:value)]
|
148
148
|
when :call_target_node
|
@@ -158,7 +158,7 @@ module Prism
|
|
158
158
|
when :class_variable_and_write_node
|
159
159
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
160
160
|
when :class_variable_operator_write_node
|
161
|
-
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:
|
161
|
+
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:binary_operator_loc), NodeField.new(:value), ConstantField.new(:binary_operator)]
|
162
162
|
when :class_variable_or_write_node
|
163
163
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
164
164
|
when :class_variable_read_node
|
@@ -170,7 +170,7 @@ module Prism
|
|
170
170
|
when :constant_and_write_node
|
171
171
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
172
172
|
when :constant_operator_write_node
|
173
|
-
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:
|
173
|
+
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:binary_operator_loc), NodeField.new(:value), ConstantField.new(:binary_operator)]
|
174
174
|
when :constant_or_write_node
|
175
175
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
176
176
|
when :constant_path_and_write_node
|
@@ -178,7 +178,7 @@ module Prism
|
|
178
178
|
when :constant_path_node
|
179
179
|
[OptionalNodeField.new(:parent), OptionalConstantField.new(:name), LocationField.new(:delimiter_loc), LocationField.new(:name_loc)]
|
180
180
|
when :constant_path_operator_write_node
|
181
|
-
[NodeField.new(:target), LocationField.new(:
|
181
|
+
[NodeField.new(:target), LocationField.new(:binary_operator_loc), NodeField.new(:value), ConstantField.new(:binary_operator)]
|
182
182
|
when :constant_path_or_write_node
|
183
183
|
[NodeField.new(:target), LocationField.new(:operator_loc), NodeField.new(:value)]
|
184
184
|
when :constant_path_target_node
|
@@ -222,7 +222,7 @@ module Prism
|
|
222
222
|
when :global_variable_and_write_node
|
223
223
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
224
224
|
when :global_variable_operator_write_node
|
225
|
-
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:
|
225
|
+
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:binary_operator_loc), NodeField.new(:value), ConstantField.new(:binary_operator)]
|
226
226
|
when :global_variable_or_write_node
|
227
227
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
228
228
|
when :global_variable_read_node
|
@@ -248,7 +248,7 @@ module Prism
|
|
248
248
|
when :index_and_write_node
|
249
249
|
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), LocationField.new(:opening_loc), OptionalNodeField.new(:arguments), LocationField.new(:closing_loc), OptionalNodeField.new(:block), LocationField.new(:operator_loc), NodeField.new(:value)]
|
250
250
|
when :index_operator_write_node
|
251
|
-
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), LocationField.new(:opening_loc), OptionalNodeField.new(:arguments), LocationField.new(:closing_loc), OptionalNodeField.new(:block), ConstantField.new(:
|
251
|
+
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), LocationField.new(:opening_loc), OptionalNodeField.new(:arguments), LocationField.new(:closing_loc), OptionalNodeField.new(:block), ConstantField.new(:binary_operator), LocationField.new(:binary_operator_loc), NodeField.new(:value)]
|
252
252
|
when :index_or_write_node
|
253
253
|
[FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), LocationField.new(:opening_loc), OptionalNodeField.new(:arguments), LocationField.new(:closing_loc), OptionalNodeField.new(:block), LocationField.new(:operator_loc), NodeField.new(:value)]
|
254
254
|
when :index_target_node
|
@@ -256,7 +256,7 @@ module Prism
|
|
256
256
|
when :instance_variable_and_write_node
|
257
257
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
258
258
|
when :instance_variable_operator_write_node
|
259
|
-
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:
|
259
|
+
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:binary_operator_loc), NodeField.new(:value), ConstantField.new(:binary_operator)]
|
260
260
|
when :instance_variable_or_write_node
|
261
261
|
[ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
|
262
262
|
when :instance_variable_read_node
|
@@ -277,6 +277,8 @@ module Prism
|
|
277
277
|
[OptionalLocationField.new(:opening_loc), NodeListField.new(:parts), OptionalLocationField.new(:closing_loc)]
|
278
278
|
when :interpolated_x_string_node
|
279
279
|
[LocationField.new(:opening_loc), NodeListField.new(:parts), LocationField.new(:closing_loc)]
|
280
|
+
when :it_local_variable_read_node
|
281
|
+
[]
|
280
282
|
when :it_parameters_node
|
281
283
|
[]
|
282
284
|
when :keyword_hash_node
|
@@ -288,7 +290,7 @@ module Prism
|
|
288
290
|
when :local_variable_and_write_node
|
289
291
|
[LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value), ConstantField.new(:name), IntegerField.new(:depth)]
|
290
292
|
when :local_variable_operator_write_node
|
291
|
-
[LocationField.new(:name_loc), LocationField.new(:
|
293
|
+
[LocationField.new(:name_loc), LocationField.new(:binary_operator_loc), NodeField.new(:value), ConstantField.new(:name), ConstantField.new(:binary_operator), IntegerField.new(:depth)]
|
292
294
|
when :local_variable_or_write_node
|
293
295
|
[LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value), ConstantField.new(:name), IntegerField.new(:depth)]
|
294
296
|
when :local_variable_read_node
|
@@ -346,7 +348,7 @@ module Prism
|
|
346
348
|
when :range_node
|
347
349
|
[FlagsField.new(:flags, [:exclude_end?]), OptionalNodeField.new(:left), OptionalNodeField.new(:right), LocationField.new(:operator_loc)]
|
348
350
|
when :rational_node
|
349
|
-
[
|
351
|
+
[FlagsField.new(:flags, [:binary?, :decimal?, :octal?, :hexadecimal?]), IntegerField.new(:numerator), IntegerField.new(:denominator)]
|
350
352
|
when :redo_node
|
351
353
|
[]
|
352
354
|
when :regular_expression_node
|