rbs 3.8.0.pre.1 → 3.8.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.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +1 -1
- data/CHANGELOG.md +16 -0
- data/core/array.rbs +64 -62
- data/core/complex.rbs +1 -1
- data/core/encoding.rbs +0 -26
- data/core/errors.rbs +4 -0
- data/core/exception.rbs +2 -2
- data/core/file.rbs +1 -8
- data/core/gc.rbs +20 -2
- data/core/hash.rbs +2 -2
- data/core/io.rbs +2 -2
- data/core/kernel.rbs +2 -2
- data/core/nil_class.rbs +3 -0
- data/core/numeric.rbs +1 -1
- data/core/proc.rbs +80 -10
- data/core/ractor.rbs +17 -0
- data/core/regexp.rbs +2 -2
- data/core/ruby_vm.rbs +1 -1
- data/core/rubygems/errors.rbs +3 -1
- data/core/rubygems/rubygems.rbs +3 -1
- data/core/string.rbs +132 -130
- data/core/time.rbs +4 -0
- data/core/trace_point.rbs +108 -113
- data/ext/rbs_extension/parser.c +1 -1
- data/lib/rbs/types.rb +2 -1
- data/lib/rbs/version.rb +1 -1
- data/stdlib/date/0/date.rbs +23 -23
- data/stdlib/net-http/0/net-http.rbs +20 -29
- data/stdlib/rdoc/0/rdoc.rbs +12 -6
- data/stdlib/resolv/0/resolv.rbs +5 -1
- data/stdlib/securerandom/0/securerandom.rbs +7 -0
- data/stdlib/socket/0/socket.rbs +9 -28
- data/stdlib/socket/0/tcp_socket.rbs +8 -30
- data/stdlib/tmpdir/0/tmpdir.rbs +2 -2
- metadata +3 -4
data/core/trace_point.rbs
CHANGED
@@ -1,123 +1,121 @@
|
|
1
1
|
# <!-- rdoc-file=trace_point.rb -->
|
2
|
-
# A class that provides the functionality of Kernel#set_trace_func in a
|
3
|
-
# Object-Oriented API.
|
2
|
+
# A class that provides the functionality of Kernel#set_trace_func in a
|
3
|
+
# well-structured Object-Oriented API.
|
4
4
|
#
|
5
5
|
# ## Example
|
6
6
|
#
|
7
|
-
#
|
7
|
+
# Use TracePoint to gather information specifically for exceptions:
|
8
8
|
#
|
9
9
|
# trace = TracePoint.new(:raise) do |tp|
|
10
|
-
#
|
10
|
+
# p [tp.lineno, tp.event, tp.raised_exception]
|
11
11
|
# end
|
12
12
|
# #=> #<TracePoint:disabled>
|
13
13
|
#
|
14
|
-
# trace.enable
|
15
|
-
# #=> false
|
14
|
+
# trace.enable #=> false
|
16
15
|
#
|
17
16
|
# 0 / 0
|
18
17
|
# #=> [5, :raise, #<ZeroDivisionError: divided by 0>]
|
19
18
|
#
|
20
19
|
# ## Events
|
21
20
|
#
|
22
|
-
# If you don't specify the
|
21
|
+
# If you don't specify the types of events you want to listen for, TracePoint
|
23
22
|
# will include all available events.
|
24
23
|
#
|
25
|
-
# **Note
|
26
|
-
# change. Instead, it is recommended
|
24
|
+
# **Note:** Do not depend on the current event set, as this list is subject to
|
25
|
+
# change. Instead, it is recommended to specify the types of events you want to
|
27
26
|
# use.
|
28
27
|
#
|
29
28
|
# To filter what is traced, you can pass any of the following as `events`:
|
30
29
|
#
|
31
30
|
# `:line`
|
32
|
-
# :
|
31
|
+
# : Execute an expression or statement on a new line.
|
33
32
|
#
|
34
33
|
# `:class`
|
35
|
-
# :
|
34
|
+
# : Start a class or module definition.
|
36
35
|
#
|
37
36
|
# `:end`
|
38
|
-
# :
|
37
|
+
# : Finish a class or module definition.
|
39
38
|
#
|
40
39
|
# `:call`
|
41
|
-
# :
|
40
|
+
# : Call a Ruby method.
|
42
41
|
#
|
43
42
|
# `:return`
|
44
|
-
# :
|
43
|
+
# : Return from a Ruby method.
|
45
44
|
#
|
46
45
|
# `:c_call`
|
47
|
-
# :
|
46
|
+
# : Call a C-language routine.
|
48
47
|
#
|
49
48
|
# `:c_return`
|
50
|
-
# :
|
49
|
+
# : Return from a C-language routine.
|
51
50
|
#
|
52
51
|
# `:raise`
|
53
|
-
# :
|
52
|
+
# : Raise an exception.
|
54
53
|
#
|
55
54
|
# `:rescue`
|
56
|
-
# :
|
55
|
+
# : Rescue an exception.
|
57
56
|
#
|
58
57
|
# `:b_call`
|
59
|
-
# :
|
58
|
+
# : Event hook at block entry.
|
60
59
|
#
|
61
60
|
# `:b_return`
|
62
|
-
# :
|
61
|
+
# : Event hook at block ending.
|
63
62
|
#
|
64
63
|
# `:a_call`
|
65
|
-
# :
|
64
|
+
# : Event hook at all calls (`call`, `b_call`, and `c_call`).
|
66
65
|
#
|
67
66
|
# `:a_return`
|
68
|
-
# :
|
67
|
+
# : Event hook at all returns (`return`, `b_return`, and `c_return`).
|
69
68
|
#
|
70
69
|
# `:thread_begin`
|
71
|
-
# :
|
70
|
+
# : Event hook at thread beginning.
|
72
71
|
#
|
73
72
|
# `:thread_end`
|
74
|
-
# :
|
73
|
+
# : Event hook at thread ending.
|
75
74
|
#
|
76
75
|
# `:fiber_switch`
|
77
|
-
# :
|
76
|
+
# : Event hook at fiber switch.
|
78
77
|
#
|
79
78
|
# `:script_compiled`
|
80
|
-
# :
|
79
|
+
# : New Ruby code compiled (with `eval`, `load`, or `require`).
|
81
80
|
#
|
82
81
|
class TracePoint
|
83
82
|
# <!--
|
84
83
|
# rdoc-file=trace_point.rb
|
85
|
-
# - TracePoint.new(*events) { |
|
84
|
+
# - TracePoint.new(*events) { |tp| block } -> tp
|
86
85
|
# -->
|
87
86
|
# Returns a new TracePoint object, not enabled by default.
|
88
87
|
#
|
89
|
-
#
|
88
|
+
# To activate the TracePoint object, use TracePoint#enable:
|
90
89
|
#
|
91
90
|
# trace = TracePoint.new(:call) do |tp|
|
92
|
-
#
|
91
|
+
# p [tp.lineno, tp.defined_class, tp.method_id, tp.event]
|
93
92
|
# end
|
94
93
|
# #=> #<TracePoint:disabled>
|
95
94
|
#
|
96
|
-
# trace.enable
|
97
|
-
# #=> false
|
95
|
+
# trace.enable #=> false
|
98
96
|
#
|
99
97
|
# puts "Hello, TracePoint!"
|
100
98
|
# # ...
|
101
99
|
# # [48, IRB::Notifier::AbstractNotifier, :printf, :call]
|
102
100
|
# # ...
|
103
101
|
#
|
104
|
-
#
|
102
|
+
# To deactivate the trace, use TracePoint#disable.
|
105
103
|
#
|
106
104
|
# trace.disable
|
107
105
|
#
|
108
106
|
# See TracePoint@Events for possible events and more information.
|
109
107
|
#
|
110
|
-
# A block must be given
|
108
|
+
# A block must be given; otherwise, an ArgumentError is raised.
|
111
109
|
#
|
112
110
|
# If the trace method isn't included in the given events filter, a RuntimeError
|
113
111
|
# is raised.
|
114
112
|
#
|
115
113
|
# TracePoint.trace(:line) do |tp|
|
116
|
-
#
|
114
|
+
# p tp.raised_exception
|
117
115
|
# end
|
118
116
|
# #=> RuntimeError: 'raised_exception' not supported by this event
|
119
117
|
#
|
120
|
-
# If the trace method is called outside block, a RuntimeError is raised.
|
118
|
+
# If the trace method is called outside a block, a RuntimeError is raised.
|
121
119
|
#
|
122
120
|
# TracePoint.trace(:line) do |tp|
|
123
121
|
# $tp = tp
|
@@ -132,13 +130,12 @@ class TracePoint
|
|
132
130
|
# rdoc-file=trace_point.rb
|
133
131
|
# - TracePoint.allow_reentry { block }
|
134
132
|
# -->
|
135
|
-
#
|
136
|
-
# are not called to avoid confusion
|
137
|
-
# reentrance
|
138
|
-
#
|
133
|
+
# Generally, while a TracePoint callback is running, other registered callbacks
|
134
|
+
# are not called to avoid confusion from reentrance. This method allows
|
135
|
+
# reentrance within a given block. Use this method carefully to avoid infinite
|
136
|
+
# callback invocation.
|
139
137
|
#
|
140
|
-
# If
|
141
|
-
# RuntimeError.
|
138
|
+
# If called when reentrance is already allowed, it raises a RuntimeError.
|
142
139
|
#
|
143
140
|
# **Example:**
|
144
141
|
#
|
@@ -146,7 +143,7 @@ class TracePoint
|
|
146
143
|
# # ---------------
|
147
144
|
#
|
148
145
|
# line_handler = TracePoint.new(:line) do |tp|
|
149
|
-
# next if tp.path != __FILE__ #
|
146
|
+
# next if tp.path != __FILE__ # Only works in this file
|
150
147
|
# puts "Line handler"
|
151
148
|
# binding.eval("class C; end")
|
152
149
|
# end.enable
|
@@ -158,15 +155,15 @@ class TracePoint
|
|
158
155
|
# class B
|
159
156
|
# end
|
160
157
|
#
|
161
|
-
# # This script will print "Class handler" only once: when inside :line
|
162
|
-
# # handler, all other handlers are ignored
|
158
|
+
# # This script will print "Class handler" only once: when inside the :line
|
159
|
+
# # handler, all other handlers are ignored.
|
163
160
|
#
|
164
161
|
# # With reentry
|
165
162
|
# # ------------
|
166
163
|
#
|
167
164
|
# line_handler = TracePoint.new(:line) do |tp|
|
168
|
-
# next if tp.path != __FILE__ #
|
169
|
-
# next if (__LINE__..__LINE__+3).cover?(tp.lineno) #
|
165
|
+
# next if tp.path != __FILE__ # Only works in this file
|
166
|
+
# next if (__LINE__..__LINE__+3).cover?(tp.lineno) # Prevent infinite calls
|
170
167
|
# puts "Line handler"
|
171
168
|
# TracePoint.allow_reentry { binding.eval("class C; end") }
|
172
169
|
# end.enable
|
@@ -178,15 +175,15 @@ class TracePoint
|
|
178
175
|
# class B
|
179
176
|
# end
|
180
177
|
#
|
181
|
-
# # This
|
178
|
+
# # This will print "Class handler" twice: inside the allow_reentry block in the :line
|
182
179
|
# # handler, other handlers are enabled.
|
183
180
|
#
|
184
181
|
# Note that the example shows the principal effect of the method, but its
|
185
182
|
# practical usage is for debugging libraries that sometimes require other
|
186
|
-
# libraries hooks to not be affected by debugger being inside trace point
|
183
|
+
# libraries' hooks to not be affected by the debugger being inside trace point
|
187
184
|
# handling. Precautions should be taken against infinite recursion in this case
|
188
|
-
# (note that we needed to filter out calls by itself from :line handler,
|
189
|
-
# otherwise it
|
185
|
+
# (note that we needed to filter out calls by itself from the :line handler,
|
186
|
+
# otherwise it would call itself infinitely).
|
190
187
|
#
|
191
188
|
def self.allow_reentry: [T] () { (nil) -> T } -> T
|
192
189
|
|
@@ -196,8 +193,8 @@ class TracePoint
|
|
196
193
|
# -->
|
197
194
|
# Returns internal information of TracePoint.
|
198
195
|
#
|
199
|
-
# The contents of the returned value are implementation
|
200
|
-
#
|
196
|
+
# The contents of the returned value are implementation-specific and may change
|
197
|
+
# in the future.
|
201
198
|
#
|
202
199
|
# This method is only for debugging TracePoint itself.
|
203
200
|
#
|
@@ -205,15 +202,15 @@ class TracePoint
|
|
205
202
|
|
206
203
|
# <!--
|
207
204
|
# rdoc-file=trace_point.rb
|
208
|
-
# - TracePoint.trace(*events) { |
|
205
|
+
# - TracePoint.trace(*events) { |tp| block } -> obj
|
209
206
|
# -->
|
210
|
-
# A convenience method for TracePoint.new
|
207
|
+
# A convenience method for TracePoint.new that activates the trace
|
211
208
|
# automatically.
|
212
209
|
#
|
213
210
|
# trace = TracePoint.trace(:call) { |tp| [tp.lineno, tp.event] }
|
214
211
|
# #=> #<TracePoint:enabled>
|
215
212
|
#
|
216
|
-
# trace.enabled?
|
213
|
+
# trace.enabled? #=> true
|
217
214
|
#
|
218
215
|
def self.trace: (*_ToSym events) { (instance tp) -> void } -> instance
|
219
216
|
|
@@ -221,9 +218,9 @@ class TracePoint
|
|
221
218
|
# rdoc-file=trace_point.rb
|
222
219
|
# - binding()
|
223
220
|
# -->
|
224
|
-
#
|
221
|
+
# Returns the generated binding object from the event.
|
225
222
|
#
|
226
|
-
# Note that for `:c_call` and `:c_return` events, the method
|
223
|
+
# Note that for `:c_call` and `:c_return` events, the method returns `nil`,
|
227
224
|
# since C methods themselves do not have bindings.
|
228
225
|
#
|
229
226
|
def binding: () -> Binding?
|
@@ -232,7 +229,7 @@ class TracePoint
|
|
232
229
|
# rdoc-file=trace_point.rb
|
233
230
|
# - callee_id()
|
234
231
|
# -->
|
235
|
-
#
|
232
|
+
# Returns the called name of the method being called.
|
236
233
|
#
|
237
234
|
def callee_id: () -> Symbol?
|
238
235
|
|
@@ -240,7 +237,7 @@ class TracePoint
|
|
240
237
|
# rdoc-file=trace_point.rb
|
241
238
|
# - defined_class()
|
242
239
|
# -->
|
243
|
-
#
|
240
|
+
# Returns the class or module of the method being called.
|
244
241
|
#
|
245
242
|
# class C; def foo; end; end
|
246
243
|
# trace = TracePoint.new(:call) do |tp|
|
@@ -249,20 +246,20 @@ class TracePoint
|
|
249
246
|
# C.new.foo
|
250
247
|
# end
|
251
248
|
#
|
252
|
-
# If method is defined by a module, then that module is returned.
|
249
|
+
# If the method is defined by a module, then that module is returned.
|
253
250
|
#
|
254
251
|
# module M; def foo; end; end
|
255
|
-
# class C; include M; end
|
252
|
+
# class C; include M; end
|
256
253
|
# trace = TracePoint.new(:call) do |tp|
|
257
254
|
# p tp.defined_class #=> M
|
258
255
|
# end.enable do
|
259
256
|
# C.new.foo
|
260
257
|
# end
|
261
258
|
#
|
262
|
-
# **Note:** #defined_class returns singleton class.
|
259
|
+
# **Note:** #defined_class returns the singleton class.
|
263
260
|
#
|
264
|
-
# 6th block parameter of Kernel#set_trace_func passes original class
|
265
|
-
# by singleton class.
|
261
|
+
# The 6th block parameter of Kernel#set_trace_func passes the original class
|
262
|
+
# attached by the singleton class.
|
266
263
|
#
|
267
264
|
# **This is a difference between Kernel#set_trace_func and TracePoint.**
|
268
265
|
#
|
@@ -277,31 +274,30 @@ class TracePoint
|
|
277
274
|
|
278
275
|
# <!--
|
279
276
|
# rdoc-file=trace_point.rb
|
280
|
-
# - trace.disable
|
277
|
+
# - trace.disable -> true or false
|
281
278
|
# - trace.disable { block } -> obj
|
282
279
|
# -->
|
283
|
-
# Deactivates the trace
|
280
|
+
# Deactivates the trace.
|
284
281
|
#
|
285
|
-
#
|
282
|
+
# Returns `true` if the trace was enabled. Returns `false` if the trace was
|
283
|
+
# disabled.
|
286
284
|
#
|
287
|
-
# trace.enabled?
|
288
|
-
# trace.disable
|
289
|
-
# trace.enabled?
|
290
|
-
# trace.disable
|
285
|
+
# trace.enabled? #=> true
|
286
|
+
# trace.disable #=> true (previous status)
|
287
|
+
# trace.enabled? #=> false
|
288
|
+
# trace.disable #=> false
|
291
289
|
#
|
292
|
-
# If a block is given, the trace will only be
|
290
|
+
# If a block is given, the trace will only be disabled within the scope of the
|
293
291
|
# block.
|
294
292
|
#
|
295
|
-
# trace.enabled?
|
296
|
-
# #=> true
|
293
|
+
# trace.enabled? #=> true
|
297
294
|
#
|
298
295
|
# trace.disable do
|
299
|
-
#
|
300
|
-
#
|
296
|
+
# trace.enabled?
|
297
|
+
# # Only disabled for this block
|
301
298
|
# end
|
302
299
|
#
|
303
|
-
# trace.enabled?
|
304
|
-
# #=> true
|
300
|
+
# trace.enabled? #=> true
|
305
301
|
#
|
306
302
|
# Note: You cannot access event hooks within the block.
|
307
303
|
#
|
@@ -313,12 +309,13 @@ class TracePoint
|
|
313
309
|
|
314
310
|
# <!--
|
315
311
|
# rdoc-file=trace_point.rb
|
316
|
-
# - trace.enable(target: nil, target_line: nil, target_thread: nil)
|
317
|
-
# - trace.enable(target: nil, target_line: nil, target_thread: :default) { block }
|
312
|
+
# - trace.enable(target: nil, target_line: nil, target_thread: nil) -> true or false
|
313
|
+
# - trace.enable(target: nil, target_line: nil, target_thread: :default) { block } -> obj
|
318
314
|
# -->
|
319
315
|
# Activates the trace.
|
320
316
|
#
|
321
|
-
# Returns `true` if trace was enabled. Returns `false` if trace was
|
317
|
+
# Returns `true` if the trace was enabled. Returns `false` if the trace was
|
318
|
+
# disabled.
|
322
319
|
#
|
323
320
|
# trace.enabled? #=> false
|
324
321
|
# trace.enable #=> false (previous state)
|
@@ -327,24 +324,22 @@ class TracePoint
|
|
327
324
|
# trace.enable #=> true (previous state)
|
328
325
|
# # trace is still enabled
|
329
326
|
#
|
330
|
-
# If a block is given, the trace will only be enabled during the block
|
331
|
-
# target and target_line are both nil, then target_thread will
|
332
|
-
# current thread if a block is given.
|
327
|
+
# If a block is given, the trace will only be enabled during the block
|
328
|
+
# execution. If target and target_line are both nil, then target_thread will
|
329
|
+
# default to the current thread if a block is given.
|
333
330
|
#
|
334
|
-
# trace.enabled?
|
335
|
-
# #=> false
|
331
|
+
# trace.enabled? #=> false
|
336
332
|
#
|
337
333
|
# trace.enable do
|
338
334
|
# trace.enabled?
|
339
|
-
# #
|
335
|
+
# # Only enabled for this block and thread
|
340
336
|
# end
|
341
337
|
#
|
342
|
-
# trace.enabled?
|
343
|
-
# #=> false
|
338
|
+
# trace.enabled? #=> false
|
344
339
|
#
|
345
|
-
# `target`, `target_line
|
346
|
-
# tracing
|
347
|
-
#
|
340
|
+
# The `target`, `target_line`, and `target_thread` parameters are used to limit
|
341
|
+
# tracing to specified code objects. `target` should be a code object for which
|
342
|
+
# RubyVM::InstructionSequence.of will return an instruction sequence.
|
348
343
|
#
|
349
344
|
# t = TracePoint.new(:line) { |tp| p tp }
|
350
345
|
#
|
@@ -359,9 +354,9 @@ class TracePoint
|
|
359
354
|
# t.enable(target: method(:m1))
|
360
355
|
#
|
361
356
|
# m1
|
362
|
-
# #
|
357
|
+
# # Prints #<TracePoint:line test.rb:4 in `m1'>
|
363
358
|
# m2
|
364
|
-
# #
|
359
|
+
# # Prints nothing
|
365
360
|
#
|
366
361
|
# Note: You cannot access event hooks within the `enable` block.
|
367
362
|
#
|
@@ -373,9 +368,9 @@ class TracePoint
|
|
373
368
|
|
374
369
|
# <!--
|
375
370
|
# rdoc-file=trace_point.rb
|
376
|
-
# - trace.enabled?
|
371
|
+
# - trace.enabled? -> true or false
|
377
372
|
# -->
|
378
|
-
#
|
373
|
+
# Returns the current status of the trace.
|
379
374
|
#
|
380
375
|
def enabled?: () -> bool
|
381
376
|
|
@@ -383,7 +378,7 @@ class TracePoint
|
|
383
378
|
# rdoc-file=trace_point.rb
|
384
379
|
# - event()
|
385
380
|
# -->
|
386
|
-
#
|
381
|
+
# Returns the type of event.
|
387
382
|
#
|
388
383
|
# See TracePoint@Events for more information.
|
389
384
|
#
|
@@ -391,9 +386,9 @@ class TracePoint
|
|
391
386
|
|
392
387
|
# <!--
|
393
388
|
# rdoc-file=trace_point.rb
|
394
|
-
# - trace.inspect
|
389
|
+
# - trace.inspect -> string
|
395
390
|
# -->
|
396
|
-
#
|
391
|
+
# Returns a string containing a human-readable TracePoint status.
|
397
392
|
#
|
398
393
|
def inspect: () -> String
|
399
394
|
|
@@ -401,7 +396,7 @@ class TracePoint
|
|
401
396
|
# rdoc-file=trace_point.rb
|
402
397
|
# - lineno()
|
403
398
|
# -->
|
404
|
-
#
|
399
|
+
# Returns the line number of the event.
|
405
400
|
#
|
406
401
|
def lineno: () -> Integer
|
407
402
|
|
@@ -409,7 +404,7 @@ class TracePoint
|
|
409
404
|
# rdoc-file=trace_point.rb
|
410
405
|
# - method_id()
|
411
406
|
# -->
|
412
|
-
#
|
407
|
+
# Returns the name at the definition of the method being called.
|
413
408
|
#
|
414
409
|
def method_id: () -> Symbol?
|
415
410
|
|
@@ -417,7 +412,7 @@ class TracePoint
|
|
417
412
|
# rdoc-file=trace_point.rb
|
418
413
|
# - path()
|
419
414
|
# -->
|
420
|
-
#
|
415
|
+
# Returns the path of the file being executed.
|
421
416
|
#
|
422
417
|
def path: () -> String
|
423
418
|
|
@@ -425,8 +420,8 @@ class TracePoint
|
|
425
420
|
# rdoc-file=trace_point.rb
|
426
421
|
# - parameters()
|
427
422
|
# -->
|
428
|
-
#
|
429
|
-
# belongs to.
|
423
|
+
# Returns the parameter definitions of the method or block that the current hook
|
424
|
+
# belongs to. The format is the same as for Method#parameters.
|
430
425
|
#
|
431
426
|
def parameters: () -> Method::param_types?
|
432
427
|
|
@@ -434,7 +429,7 @@ class TracePoint
|
|
434
429
|
# rdoc-file=trace_point.rb
|
435
430
|
# - raised_exception()
|
436
431
|
# -->
|
437
|
-
#
|
432
|
+
# Returns the exception raised on the `:raise` event or rescued on the `:rescue`
|
438
433
|
# event.
|
439
434
|
#
|
440
435
|
def raised_exception: () -> Exception
|
@@ -443,7 +438,7 @@ class TracePoint
|
|
443
438
|
# rdoc-file=trace_point.rb
|
444
439
|
# - return_value()
|
445
440
|
# -->
|
446
|
-
#
|
441
|
+
# Returns the return value from `:return`, `:c_return`, and `:b_return` events.
|
447
442
|
#
|
448
443
|
def return_value: () -> untyped
|
449
444
|
|
@@ -451,9 +446,9 @@ class TracePoint
|
|
451
446
|
# rdoc-file=trace_point.rb
|
452
447
|
# - self()
|
453
448
|
# -->
|
454
|
-
#
|
449
|
+
# Returns the trace object during the event.
|
455
450
|
#
|
456
|
-
#
|
451
|
+
# Similar to the following, but it returns the correct object (the method
|
457
452
|
# receiver) for `:c_call` and `:c_return` events:
|
458
453
|
#
|
459
454
|
# trace.binding.eval('self')
|
@@ -464,8 +459,8 @@ class TracePoint
|
|
464
459
|
# rdoc-file=trace_point.rb
|
465
460
|
# - eval_script()
|
466
461
|
# -->
|
467
|
-
#
|
468
|
-
# event. If loaded from a file, it
|
462
|
+
# Returns the compiled source code (String) from eval methods on the
|
463
|
+
# `:script_compiled` event. If loaded from a file, it returns `nil`.
|
469
464
|
#
|
470
465
|
def eval_script: () -> String?
|
471
466
|
|
@@ -473,10 +468,10 @@ class TracePoint
|
|
473
468
|
# rdoc-file=trace_point.rb
|
474
469
|
# - instruction_sequence()
|
475
470
|
# -->
|
476
|
-
#
|
477
|
-
# instance on the `:script_compiled` event.
|
471
|
+
# Returns the compiled instruction sequence represented by a
|
472
|
+
# RubyVM::InstructionSequence instance on the `:script_compiled` event.
|
478
473
|
#
|
479
|
-
# Note that this method is
|
474
|
+
# Note that this method is CRuby-specific.
|
480
475
|
#
|
481
476
|
def instruction_sequence: () -> RubyVM::InstructionSequence
|
482
477
|
end
|
data/ext/rbs_extension/parser.c
CHANGED
@@ -1220,7 +1220,7 @@ static VALUE parse_type_params(parserstate *state, range *rg, bool module_type_p
|
|
1220
1220
|
|
1221
1221
|
VALUE location = rbs_new_location(state->buffer, param_range);
|
1222
1222
|
rbs_loc *loc = rbs_check_location(location);
|
1223
|
-
rbs_loc_alloc_children(loc,
|
1223
|
+
rbs_loc_alloc_children(loc, 5);
|
1224
1224
|
rbs_loc_add_required_child(loc, rb_intern("name"), name_range);
|
1225
1225
|
rbs_loc_add_optional_child(loc, rb_intern("variance"), variance_range);
|
1226
1226
|
rbs_loc_add_optional_child(loc, rb_intern("unchecked"), unchecked_range);
|
data/lib/rbs/types.rb
CHANGED
@@ -1427,6 +1427,7 @@ module RBS
|
|
1427
1427
|
def each_type(&block)
|
1428
1428
|
if block
|
1429
1429
|
type.each_type(&block)
|
1430
|
+
yield self_type if self_type
|
1430
1431
|
self.block&.type&.each_type(&block)
|
1431
1432
|
if self_type = self.block&.self_type
|
1432
1433
|
yield self_type
|
@@ -1467,7 +1468,7 @@ module RBS
|
|
1467
1468
|
end
|
1468
1469
|
|
1469
1470
|
def with_nonreturn_void?
|
1470
|
-
if type.with_nonreturn_void?
|
1471
|
+
if type.with_nonreturn_void? || self_type&.with_nonreturn_void?
|
1471
1472
|
true
|
1472
1473
|
else
|
1473
1474
|
if block = block()
|
data/lib/rbs/version.rb
CHANGED