prism 0.19.0 → 0.24.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 +102 -1
- data/Makefile +5 -0
- data/README.md +9 -6
- data/config.yml +236 -38
- data/docs/build_system.md +19 -2
- data/docs/cruby_compilation.md +27 -0
- data/docs/parser_translation.md +34 -0
- data/docs/parsing_rules.md +19 -0
- data/docs/releasing.md +84 -16
- data/docs/ruby_api.md +1 -1
- data/docs/ruby_parser_translation.md +19 -0
- data/docs/serialization.md +19 -5
- data/ext/prism/api_node.c +1989 -1525
- data/ext/prism/extension.c +130 -30
- data/ext/prism/extension.h +2 -2
- data/include/prism/ast.h +1700 -505
- data/include/prism/defines.h +8 -0
- data/include/prism/diagnostic.h +49 -7
- data/include/prism/encoding.h +17 -0
- data/include/prism/options.h +40 -14
- data/include/prism/parser.h +34 -18
- data/include/prism/util/pm_buffer.h +9 -0
- data/include/prism/util/pm_constant_pool.h +18 -0
- data/include/prism/util/pm_newline_list.h +4 -14
- data/include/prism/util/pm_strpbrk.h +4 -1
- data/include/prism/version.h +2 -2
- data/include/prism.h +19 -2
- data/lib/prism/debug.rb +11 -5
- data/lib/prism/desugar_compiler.rb +225 -80
- data/lib/prism/dot_visitor.rb +36 -14
- data/lib/prism/dsl.rb +302 -299
- data/lib/prism/ffi.rb +107 -76
- data/lib/prism/lex_compat.rb +17 -1
- data/lib/prism/node.rb +4580 -2607
- data/lib/prism/node_ext.rb +27 -4
- data/lib/prism/parse_result.rb +75 -29
- data/lib/prism/serialize.rb +633 -305
- data/lib/prism/translation/parser/compiler.rb +1838 -0
- data/lib/prism/translation/parser/lexer.rb +335 -0
- data/lib/prism/translation/parser/rubocop.rb +45 -0
- data/lib/prism/translation/parser.rb +190 -0
- data/lib/prism/translation/parser33.rb +12 -0
- data/lib/prism/translation/parser34.rb +12 -0
- data/lib/prism/translation/ripper.rb +696 -0
- data/lib/prism/translation/ruby_parser.rb +1521 -0
- data/lib/prism/translation.rb +11 -0
- data/lib/prism.rb +1 -1
- data/prism.gemspec +18 -7
- data/rbi/prism.rbi +150 -88
- data/rbi/prism_static.rbi +15 -3
- data/sig/prism.rbs +996 -961
- data/sig/prism_static.rbs +123 -46
- data/src/diagnostic.c +264 -219
- data/src/encoding.c +21 -26
- data/src/node.c +2 -6
- data/src/options.c +29 -5
- data/src/prettyprint.c +176 -44
- data/src/prism.c +1499 -564
- data/src/serialize.c +35 -21
- data/src/token_type.c +353 -4
- data/src/util/pm_buffer.c +11 -0
- data/src/util/pm_constant_pool.c +37 -11
- data/src/util/pm_newline_list.c +6 -15
- data/src/util/pm_string.c +0 -7
- data/src/util/pm_strpbrk.c +122 -14
- metadata +16 -5
- data/docs/building.md +0 -29
- data/lib/prism/ripper_compat.rb +0 -207
@@ -1,6 +1,216 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Prism
|
4
|
+
class DesugarAndWriteNode # :nodoc:
|
5
|
+
attr_reader :node, :source, :read_class, :write_class, :arguments
|
6
|
+
|
7
|
+
def initialize(node, source, read_class, write_class, *arguments)
|
8
|
+
@node = node
|
9
|
+
@source = source
|
10
|
+
@read_class = read_class
|
11
|
+
@write_class = write_class
|
12
|
+
@arguments = arguments
|
13
|
+
end
|
14
|
+
|
15
|
+
# Desugar `x &&= y` to `x && x = y`
|
16
|
+
def compile
|
17
|
+
AndNode.new(
|
18
|
+
source,
|
19
|
+
read_class.new(source, *arguments, node.name_loc),
|
20
|
+
write_class.new(source, *arguments, node.name_loc, node.value, node.operator_loc, node.location),
|
21
|
+
node.operator_loc,
|
22
|
+
node.location
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
class DesugarOrWriteDefinedNode # :nodoc:
|
28
|
+
attr_reader :node, :source, :read_class, :write_class, :arguments
|
29
|
+
|
30
|
+
def initialize(node, source, read_class, write_class, *arguments)
|
31
|
+
@node = node
|
32
|
+
@source = source
|
33
|
+
@read_class = read_class
|
34
|
+
@write_class = write_class
|
35
|
+
@arguments = arguments
|
36
|
+
end
|
37
|
+
|
38
|
+
# Desugar `x ||= y` to `defined?(x) ? x : x = y`
|
39
|
+
def compile
|
40
|
+
IfNode.new(
|
41
|
+
source,
|
42
|
+
node.operator_loc,
|
43
|
+
DefinedNode.new(source, nil, read_class.new(source, *arguments, node.name_loc), nil, node.operator_loc, node.name_loc),
|
44
|
+
node.operator_loc,
|
45
|
+
StatementsNode.new(source, [read_class.new(source, *arguments, node.name_loc)], node.location),
|
46
|
+
ElseNode.new(
|
47
|
+
source,
|
48
|
+
node.operator_loc,
|
49
|
+
StatementsNode.new(
|
50
|
+
source,
|
51
|
+
[write_class.new(source, *arguments, node.name_loc, node.value, node.operator_loc, node.location)],
|
52
|
+
node.location
|
53
|
+
),
|
54
|
+
node.operator_loc,
|
55
|
+
node.location
|
56
|
+
),
|
57
|
+
node.operator_loc,
|
58
|
+
node.location
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class DesugarOperatorWriteNode # :nodoc:
|
64
|
+
attr_reader :node, :source, :read_class, :write_class, :arguments
|
65
|
+
|
66
|
+
def initialize(node, source, read_class, write_class, *arguments)
|
67
|
+
@node = node
|
68
|
+
@source = source
|
69
|
+
@read_class = read_class
|
70
|
+
@write_class = write_class
|
71
|
+
@arguments = arguments
|
72
|
+
end
|
73
|
+
|
74
|
+
# Desugar `x += y` to `x = x + y`
|
75
|
+
def compile
|
76
|
+
write_class.new(
|
77
|
+
source,
|
78
|
+
*arguments,
|
79
|
+
node.name_loc,
|
80
|
+
CallNode.new(
|
81
|
+
source,
|
82
|
+
0,
|
83
|
+
read_class.new(source, *arguments, node.name_loc),
|
84
|
+
nil,
|
85
|
+
node.operator_loc.slice.chomp("="),
|
86
|
+
node.operator_loc.copy(length: node.operator_loc.length - 1),
|
87
|
+
nil,
|
88
|
+
ArgumentsNode.new(source, 0, [node.value], node.value.location),
|
89
|
+
nil,
|
90
|
+
nil,
|
91
|
+
node.location
|
92
|
+
),
|
93
|
+
node.operator_loc.copy(start_offset: node.operator_loc.end_offset - 1, length: 1),
|
94
|
+
node.location
|
95
|
+
)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class DesugarOrWriteNode # :nodoc:
|
100
|
+
attr_reader :node, :source, :read_class, :write_class, :arguments
|
101
|
+
|
102
|
+
def initialize(node, source, read_class, write_class, *arguments)
|
103
|
+
@node = node
|
104
|
+
@source = source
|
105
|
+
@read_class = read_class
|
106
|
+
@write_class = write_class
|
107
|
+
@arguments = arguments
|
108
|
+
end
|
109
|
+
|
110
|
+
# Desugar `x ||= y` to `x || x = y`
|
111
|
+
def compile
|
112
|
+
OrNode.new(
|
113
|
+
source,
|
114
|
+
read_class.new(source, *arguments, node.name_loc),
|
115
|
+
write_class.new(source, *arguments, node.name_loc, node.value, node.operator_loc, node.location),
|
116
|
+
node.operator_loc,
|
117
|
+
node.location
|
118
|
+
)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
private_constant :DesugarAndWriteNode, :DesugarOrWriteNode, :DesugarOrWriteDefinedNode, :DesugarOperatorWriteNode
|
123
|
+
|
124
|
+
class ClassVariableAndWriteNode
|
125
|
+
def desugar # :nodoc:
|
126
|
+
DesugarAndWriteNode.new(self, source, ClassVariableReadNode, ClassVariableWriteNode, name).compile
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
class ClassVariableOrWriteNode
|
131
|
+
def desugar # :nodoc:
|
132
|
+
DesugarOrWriteDefinedNode.new(self, source, ClassVariableReadNode, ClassVariableWriteNode, name).compile
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
class ClassVariableOperatorWriteNode
|
137
|
+
def desugar # :nodoc:
|
138
|
+
DesugarOperatorWriteNode.new(self, source, ClassVariableReadNode, ClassVariableWriteNode, name).compile
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class ConstantAndWriteNode
|
143
|
+
def desugar # :nodoc:
|
144
|
+
DesugarAndWriteNode.new(self, source, ConstantReadNode, ConstantWriteNode, name).compile
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
class ConstantOrWriteNode
|
149
|
+
def desugar # :nodoc:
|
150
|
+
DesugarOrWriteDefinedNode.new(self, source, ConstantReadNode, ConstantWriteNode, name).compile
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
class ConstantOperatorWriteNode
|
155
|
+
def desugar # :nodoc:
|
156
|
+
DesugarOperatorWriteNode.new(self, source, ConstantReadNode, ConstantWriteNode, name).compile
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
class GlobalVariableAndWriteNode
|
161
|
+
def desugar # :nodoc:
|
162
|
+
DesugarAndWriteNode.new(self, source, GlobalVariableReadNode, GlobalVariableWriteNode, name).compile
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
class GlobalVariableOrWriteNode
|
167
|
+
def desugar # :nodoc:
|
168
|
+
DesugarOrWriteDefinedNode.new(self, source, GlobalVariableReadNode, GlobalVariableWriteNode, name).compile
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
class GlobalVariableOperatorWriteNode
|
173
|
+
def desugar # :nodoc:
|
174
|
+
DesugarOperatorWriteNode.new(self, source, GlobalVariableReadNode, GlobalVariableWriteNode, name).compile
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
class InstanceVariableAndWriteNode
|
179
|
+
def desugar # :nodoc:
|
180
|
+
DesugarAndWriteNode.new(self, source, InstanceVariableReadNode, InstanceVariableWriteNode, name).compile
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
class InstanceVariableOrWriteNode
|
185
|
+
def desugar # :nodoc:
|
186
|
+
DesugarOrWriteNode.new(self, source, InstanceVariableReadNode, InstanceVariableWriteNode, name).compile
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
class InstanceVariableOperatorWriteNode
|
191
|
+
def desugar # :nodoc:
|
192
|
+
DesugarOperatorWriteNode.new(self, source, InstanceVariableReadNode, InstanceVariableWriteNode, name).compile
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
class LocalVariableAndWriteNode
|
197
|
+
def desugar # :nodoc:
|
198
|
+
DesugarAndWriteNode.new(self, source, LocalVariableReadNode, LocalVariableWriteNode, name, depth).compile
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
class LocalVariableOrWriteNode
|
203
|
+
def desugar # :nodoc:
|
204
|
+
DesugarOrWriteNode.new(self, source, LocalVariableReadNode, LocalVariableWriteNode, name, depth).compile
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
class LocalVariableOperatorWriteNode
|
209
|
+
def desugar # :nodoc:
|
210
|
+
DesugarOperatorWriteNode.new(self, source, LocalVariableReadNode, LocalVariableWriteNode, name, depth).compile
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
4
214
|
# DesugarCompiler is a compiler that desugars Ruby code into a more primitive
|
5
215
|
# form. This is useful for consumers that want to deal with fewer node types.
|
6
216
|
class DesugarCompiler < MutationCompiler
|
@@ -10,7 +220,7 @@ module Prism
|
|
10
220
|
#
|
11
221
|
# @@foo && @@foo = bar
|
12
222
|
def visit_class_variable_and_write_node(node)
|
13
|
-
|
223
|
+
node.desugar
|
14
224
|
end
|
15
225
|
|
16
226
|
# @@foo ||= bar
|
@@ -19,7 +229,7 @@ module Prism
|
|
19
229
|
#
|
20
230
|
# defined?(@@foo) ? @@foo : @@foo = bar
|
21
231
|
def visit_class_variable_or_write_node(node)
|
22
|
-
|
232
|
+
node.desugar
|
23
233
|
end
|
24
234
|
|
25
235
|
# @@foo += bar
|
@@ -28,7 +238,7 @@ module Prism
|
|
28
238
|
#
|
29
239
|
# @@foo = @@foo + bar
|
30
240
|
def visit_class_variable_operator_write_node(node)
|
31
|
-
|
241
|
+
node.desugar
|
32
242
|
end
|
33
243
|
|
34
244
|
# Foo &&= bar
|
@@ -37,7 +247,7 @@ module Prism
|
|
37
247
|
#
|
38
248
|
# Foo && Foo = bar
|
39
249
|
def visit_constant_and_write_node(node)
|
40
|
-
|
250
|
+
node.desugar
|
41
251
|
end
|
42
252
|
|
43
253
|
# Foo ||= bar
|
@@ -46,7 +256,7 @@ module Prism
|
|
46
256
|
#
|
47
257
|
# defined?(Foo) ? Foo : Foo = bar
|
48
258
|
def visit_constant_or_write_node(node)
|
49
|
-
|
259
|
+
node.desugar
|
50
260
|
end
|
51
261
|
|
52
262
|
# Foo += bar
|
@@ -55,7 +265,7 @@ module Prism
|
|
55
265
|
#
|
56
266
|
# Foo = Foo + bar
|
57
267
|
def visit_constant_operator_write_node(node)
|
58
|
-
|
268
|
+
node.desugar
|
59
269
|
end
|
60
270
|
|
61
271
|
# $foo &&= bar
|
@@ -64,7 +274,7 @@ module Prism
|
|
64
274
|
#
|
65
275
|
# $foo && $foo = bar
|
66
276
|
def visit_global_variable_and_write_node(node)
|
67
|
-
|
277
|
+
node.desugar
|
68
278
|
end
|
69
279
|
|
70
280
|
# $foo ||= bar
|
@@ -73,7 +283,7 @@ module Prism
|
|
73
283
|
#
|
74
284
|
# defined?($foo) ? $foo : $foo = bar
|
75
285
|
def visit_global_variable_or_write_node(node)
|
76
|
-
|
286
|
+
node.desugar
|
77
287
|
end
|
78
288
|
|
79
289
|
# $foo += bar
|
@@ -82,7 +292,7 @@ module Prism
|
|
82
292
|
#
|
83
293
|
# $foo = $foo + bar
|
84
294
|
def visit_global_variable_operator_write_node(node)
|
85
|
-
|
295
|
+
node.desugar
|
86
296
|
end
|
87
297
|
|
88
298
|
# @foo &&= bar
|
@@ -91,7 +301,7 @@ module Prism
|
|
91
301
|
#
|
92
302
|
# @foo && @foo = bar
|
93
303
|
def visit_instance_variable_and_write_node(node)
|
94
|
-
|
304
|
+
node.desugar
|
95
305
|
end
|
96
306
|
|
97
307
|
# @foo ||= bar
|
@@ -100,7 +310,7 @@ module Prism
|
|
100
310
|
#
|
101
311
|
# @foo || @foo = bar
|
102
312
|
def visit_instance_variable_or_write_node(node)
|
103
|
-
|
313
|
+
node.desugar
|
104
314
|
end
|
105
315
|
|
106
316
|
# @foo += bar
|
@@ -109,7 +319,7 @@ module Prism
|
|
109
319
|
#
|
110
320
|
# @foo = @foo + bar
|
111
321
|
def visit_instance_variable_operator_write_node(node)
|
112
|
-
|
322
|
+
node.desugar
|
113
323
|
end
|
114
324
|
|
115
325
|
# foo &&= bar
|
@@ -118,7 +328,7 @@ module Prism
|
|
118
328
|
#
|
119
329
|
# foo && foo = bar
|
120
330
|
def visit_local_variable_and_write_node(node)
|
121
|
-
|
331
|
+
node.desugar
|
122
332
|
end
|
123
333
|
|
124
334
|
# foo ||= bar
|
@@ -127,7 +337,7 @@ module Prism
|
|
127
337
|
#
|
128
338
|
# foo || foo = bar
|
129
339
|
def visit_local_variable_or_write_node(node)
|
130
|
-
|
340
|
+
node.desugar
|
131
341
|
end
|
132
342
|
|
133
343
|
# foo += bar
|
@@ -136,72 +346,7 @@ module Prism
|
|
136
346
|
#
|
137
347
|
# foo = foo + bar
|
138
348
|
def visit_local_variable_operator_write_node(node)
|
139
|
-
|
140
|
-
end
|
141
|
-
|
142
|
-
private
|
143
|
-
|
144
|
-
# Desugar `x &&= y` to `x && x = y`
|
145
|
-
def desugar_and_write_node(node, read_class, write_class, *arguments)
|
146
|
-
AndNode.new(
|
147
|
-
read_class.new(*arguments, node.name_loc),
|
148
|
-
write_class.new(*arguments, node.name_loc, node.value, node.operator_loc, node.location),
|
149
|
-
node.operator_loc,
|
150
|
-
node.location
|
151
|
-
)
|
152
|
-
end
|
153
|
-
|
154
|
-
# Desugar `x += y` to `x = x + y`
|
155
|
-
def desugar_operator_write_node(node, read_class, write_class, *arguments)
|
156
|
-
write_class.new(
|
157
|
-
*arguments,
|
158
|
-
node.name_loc,
|
159
|
-
CallNode.new(
|
160
|
-
0,
|
161
|
-
read_class.new(*arguments, node.name_loc),
|
162
|
-
nil,
|
163
|
-
node.operator_loc.slice.chomp("="),
|
164
|
-
node.operator_loc.copy(length: node.operator_loc.length - 1),
|
165
|
-
nil,
|
166
|
-
ArgumentsNode.new(0, [node.value], node.value.location),
|
167
|
-
nil,
|
168
|
-
nil,
|
169
|
-
node.location
|
170
|
-
),
|
171
|
-
node.operator_loc.copy(start_offset: node.operator_loc.end_offset - 1, length: 1),
|
172
|
-
node.location
|
173
|
-
)
|
174
|
-
end
|
175
|
-
|
176
|
-
# Desugar `x ||= y` to `x || x = y`
|
177
|
-
def desugar_or_write_node(node, read_class, write_class, *arguments)
|
178
|
-
OrNode.new(
|
179
|
-
read_class.new(*arguments, node.name_loc),
|
180
|
-
write_class.new(*arguments, node.name_loc, node.value, node.operator_loc, node.location),
|
181
|
-
node.operator_loc,
|
182
|
-
node.location
|
183
|
-
)
|
184
|
-
end
|
185
|
-
|
186
|
-
# Desugar `x ||= y` to `defined?(x) ? x : x = y`
|
187
|
-
def desugar_or_write_defined_node(node, read_class, write_class, *arguments)
|
188
|
-
IfNode.new(
|
189
|
-
node.operator_loc,
|
190
|
-
DefinedNode.new(nil, read_class.new(*arguments, node.name_loc), nil, node.operator_loc, node.name_loc),
|
191
|
-
node.operator_loc,
|
192
|
-
StatementsNode.new([read_class.new(*arguments, node.name_loc)], node.location),
|
193
|
-
ElseNode.new(
|
194
|
-
node.operator_loc,
|
195
|
-
StatementsNode.new(
|
196
|
-
[write_class.new(*arguments, node.name_loc, node.value, node.operator_loc, node.location)],
|
197
|
-
node.location
|
198
|
-
),
|
199
|
-
node.operator_loc,
|
200
|
-
node.location
|
201
|
-
),
|
202
|
-
node.operator_loc,
|
203
|
-
node.location
|
204
|
-
)
|
349
|
+
node.desugar
|
205
350
|
end
|
206
351
|
end
|
207
352
|
end
|
data/lib/prism/dot_visitor.rb
CHANGED
@@ -353,10 +353,8 @@ module Prism
|
|
353
353
|
digraph.edge("#{id}:key -> #{node_id(node.key)};")
|
354
354
|
|
355
355
|
# value
|
356
|
-
|
357
|
-
|
358
|
-
digraph.edge("#{id}:value -> #{node_id(value)};")
|
359
|
-
end
|
356
|
+
table.field("value", port: true)
|
357
|
+
digraph.edge("#{id}:value -> #{node_id(node.value)};")
|
360
358
|
|
361
359
|
# operator_loc
|
362
360
|
unless (operator_loc = node.operator_loc).nil?
|
@@ -488,6 +486,9 @@ module Prism
|
|
488
486
|
table = Table.new("BlockLocalVariableNode")
|
489
487
|
id = node_id(node)
|
490
488
|
|
489
|
+
# flags
|
490
|
+
table.field("flags", parameter_flags_inspect(node))
|
491
|
+
|
491
492
|
# name
|
492
493
|
table.field("name", node.name.inspect)
|
493
494
|
|
@@ -508,9 +509,6 @@ module Prism
|
|
508
509
|
# locals
|
509
510
|
table.field("locals", node.locals.inspect)
|
510
511
|
|
511
|
-
# locals_body_index
|
512
|
-
table.field("locals_body_index", node.locals_body_index.inspect)
|
513
|
-
|
514
512
|
# parameters
|
515
513
|
unless (parameters = node.parameters).nil?
|
516
514
|
table.field("parameters", port: true)
|
@@ -543,6 +541,9 @@ module Prism
|
|
543
541
|
table = Table.new("BlockParameterNode")
|
544
542
|
id = node_id(node)
|
545
543
|
|
544
|
+
# flags
|
545
|
+
table.field("flags", parameter_flags_inspect(node))
|
546
|
+
|
546
547
|
# name
|
547
548
|
table.field("name", node.name.inspect)
|
548
549
|
|
@@ -1501,9 +1502,6 @@ module Prism
|
|
1501
1502
|
# locals
|
1502
1503
|
table.field("locals", node.locals.inspect)
|
1503
1504
|
|
1504
|
-
# locals_body_index
|
1505
|
-
table.field("locals_body_index", node.locals_body_index.inspect)
|
1506
|
-
|
1507
1505
|
# def_keyword_loc
|
1508
1506
|
table.field("def_keyword_loc", location_inspect(node.def_keyword_loc))
|
1509
1507
|
|
@@ -2805,6 +2803,9 @@ module Prism
|
|
2805
2803
|
table = Table.new("KeywordRestParameterNode")
|
2806
2804
|
id = node_id(node)
|
2807
2805
|
|
2806
|
+
# flags
|
2807
|
+
table.field("flags", parameter_flags_inspect(node))
|
2808
|
+
|
2808
2809
|
# name
|
2809
2810
|
table.field("name", node.name.inspect)
|
2810
2811
|
|
@@ -2833,9 +2834,6 @@ module Prism
|
|
2833
2834
|
# locals
|
2834
2835
|
table.field("locals", node.locals.inspect)
|
2835
2836
|
|
2836
|
-
# locals_body_index
|
2837
|
-
table.field("locals_body_index", node.locals_body_index.inspect)
|
2838
|
-
|
2839
2837
|
# operator_loc
|
2840
2838
|
table.field("operator_loc", location_inspect(node.operator_loc))
|
2841
2839
|
|
@@ -3404,6 +3402,9 @@ module Prism
|
|
3404
3402
|
table = Table.new("OptionalKeywordParameterNode")
|
3405
3403
|
id = node_id(node)
|
3406
3404
|
|
3405
|
+
# flags
|
3406
|
+
table.field("flags", parameter_flags_inspect(node))
|
3407
|
+
|
3407
3408
|
# name
|
3408
3409
|
table.field("name", node.name.inspect)
|
3409
3410
|
|
@@ -3428,6 +3429,9 @@ module Prism
|
|
3428
3429
|
table = Table.new("OptionalParameterNode")
|
3429
3430
|
id = node_id(node)
|
3430
3431
|
|
3432
|
+
# flags
|
3433
|
+
table.field("flags", parameter_flags_inspect(node))
|
3434
|
+
|
3431
3435
|
# name
|
3432
3436
|
table.field("name", node.name.inspect)
|
3433
3437
|
|
@@ -3810,6 +3814,9 @@ module Prism
|
|
3810
3814
|
table = Table.new("RequiredKeywordParameterNode")
|
3811
3815
|
id = node_id(node)
|
3812
3816
|
|
3817
|
+
# flags
|
3818
|
+
table.field("flags", parameter_flags_inspect(node))
|
3819
|
+
|
3813
3820
|
# name
|
3814
3821
|
table.field("name", node.name.inspect)
|
3815
3822
|
|
@@ -3830,6 +3837,9 @@ module Prism
|
|
3830
3837
|
table = Table.new("RequiredParameterNode")
|
3831
3838
|
id = node_id(node)
|
3832
3839
|
|
3840
|
+
# flags
|
3841
|
+
table.field("flags", parameter_flags_inspect(node))
|
3842
|
+
|
3833
3843
|
# name
|
3834
3844
|
table.field("name", node.name.inspect)
|
3835
3845
|
|
@@ -3925,6 +3935,9 @@ module Prism
|
|
3925
3935
|
table = Table.new("RestParameterNode")
|
3926
3936
|
id = node_id(node)
|
3927
3937
|
|
3938
|
+
# flags
|
3939
|
+
table.field("flags", parameter_flags_inspect(node))
|
3940
|
+
|
3928
3941
|
# name
|
3929
3942
|
table.field("name", node.name.inspect)
|
3930
3943
|
|
@@ -4524,6 +4537,7 @@ module Prism
|
|
4524
4537
|
flags << "safe_navigation" if node.safe_navigation?
|
4525
4538
|
flags << "variable_call" if node.variable_call?
|
4526
4539
|
flags << "attribute_write" if node.attribute_write?
|
4540
|
+
flags << "ignore_visibility" if node.ignore_visibility?
|
4527
4541
|
flags.join(", ")
|
4528
4542
|
end
|
4529
4543
|
|
@@ -4551,7 +4565,7 @@ module Prism
|
|
4551
4565
|
# comma-separated list.
|
4552
4566
|
def keyword_hash_node_flags_inspect(node)
|
4553
4567
|
flags = []
|
4554
|
-
flags << "
|
4568
|
+
flags << "symbol_keys" if node.symbol_keys?
|
4555
4569
|
flags.join(", ")
|
4556
4570
|
end
|
4557
4571
|
|
@@ -4563,6 +4577,14 @@ module Prism
|
|
4563
4577
|
flags.join(", ")
|
4564
4578
|
end
|
4565
4579
|
|
4580
|
+
# Inspect a node that has parameter_flags flags to display the flags as a
|
4581
|
+
# comma-separated list.
|
4582
|
+
def parameter_flags_inspect(node)
|
4583
|
+
flags = []
|
4584
|
+
flags << "repeated_parameter" if node.repeated_parameter?
|
4585
|
+
flags.join(", ")
|
4586
|
+
end
|
4587
|
+
|
4566
4588
|
# Inspect a node that has range_flags flags to display the flags as a
|
4567
4589
|
# comma-separated list.
|
4568
4590
|
def range_flags_inspect(node)
|