rbs 3.6.0.pre.1 → 3.6.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/Rakefile +2 -2
- data/core/array.rbs +0 -2
- data/core/complex.rbs +0 -2
- data/core/data.rbs +0 -2
- data/core/dir.rbs +0 -2
- data/core/encoding.rbs +0 -2
- data/core/enumerator/product.rbs +0 -2
- data/core/enumerator.rbs +1 -1
- data/core/errors.rbs +0 -12
- data/core/file.rbs +0 -2
- data/core/float.rbs +0 -2
- data/core/hash.rbs +0 -2
- data/core/integer.rbs +0 -2
- data/core/io/buffer.rbs +0 -2
- data/core/kernel.rbs +4 -4
- data/core/module.rbs +2 -2
- data/core/numeric.rbs +0 -2
- data/core/object_space/weak_key_map.rbs +0 -2
- data/core/ractor.rbs +0 -6
- data/core/rational.rbs +0 -2
- data/core/rbs/unnamed/argf.rbs +0 -2
- data/core/ruby_vm.rbs +305 -0
- data/core/trace_point.rbs +2 -2
- data/lib/rbs/ast/type_param.rb +44 -11
- data/lib/rbs/cli/validate.rb +6 -4
- data/lib/rbs/definition.rb +2 -8
- data/lib/rbs/definition_builder/ancestor_builder.rb +23 -7
- data/lib/rbs/definition_builder.rb +7 -6
- data/lib/rbs/errors.rb +38 -0
- data/lib/rbs/prototype/rb.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/definition.rbs +1 -1
- data/sig/errors.rbs +14 -0
- data/sig/members.rbs +1 -2
- data/sig/type_param.rbs +9 -5
- data/sig/types.rbs +12 -5
- data/stdlib/bigdecimal/0/big_decimal.rbs +0 -2
- data/stdlib/cgi/0/core.rbs +0 -10
- data/stdlib/date/0/date.rbs +0 -2
- data/stdlib/date/0/date_time.rbs +0 -2
- data/stdlib/dbm/0/dbm.rbs +0 -2
- data/stdlib/delegate/0/delegator.rbs +0 -2
- data/stdlib/delegate/0/simple_delegator.rbs +0 -2
- data/stdlib/digest/0/digest.rbs +0 -4
- data/stdlib/etc/0/etc.rbs +0 -4
- data/stdlib/json/0/json.rbs +22 -0
- data/stdlib/logger/0/formatter.rbs +0 -2
- data/stdlib/logger/0/log_device.rbs +0 -2
- data/stdlib/logger/0/logger.rbs +0 -2
- data/stdlib/monitor/0/monitor.rbs +0 -6
- data/stdlib/mutex_m/0/mutex_m.rbs +0 -2
- data/stdlib/net-http/0/net-http.rbs +0 -8
- data/stdlib/observable/0/observable.rbs +0 -2
- data/stdlib/open-uri/0/open-uri.rbs +1 -1
- data/stdlib/open3/0/open3.rbs +155 -0
- data/stdlib/openssl/0/openssl.rbs +0 -112
- data/stdlib/optparse/0/optparse.rbs +0 -22
- data/stdlib/pathname/0/pathname.rbs +0 -2
- data/stdlib/pstore/0/pstore.rbs +0 -2
- data/stdlib/resolv/0/resolv.rbs +0 -74
- data/stdlib/singleton/0/singleton.rbs +0 -2
- data/stdlib/socket/0/addrinfo.rbs +0 -2
- data/stdlib/socket/0/basic_socket.rbs +0 -2
- data/stdlib/socket/0/ip_socket.rbs +0 -2
- data/stdlib/socket/0/socket.rbs +0 -8
- data/stdlib/socket/0/tcp_server.rbs +0 -2
- data/stdlib/socket/0/udp_socket.rbs +0 -2
- data/stdlib/socket/0/unix_server.rbs +0 -2
- data/stdlib/socket/0/unix_socket.rbs +0 -2
- data/stdlib/strscan/0/string_scanner.rbs +0 -2
- data/stdlib/tempfile/0/tempfile.rbs +0 -4
- data/stdlib/zlib/0/deflate.rbs +0 -2
- data/stdlib/zlib/0/gzip_file/error.rbs +0 -2
- data/stdlib/zlib/0/gzip_file.rbs +0 -2
- data/stdlib/zlib/0/gzip_reader.rbs +0 -2
- data/stdlib/zlib/0/gzip_writer.rbs +0 -2
- data/stdlib/zlib/0/inflate.rbs +0 -2
- data/stdlib/zlib/0/zstream.rbs +0 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6d0650c01c5b470a842e74e253097e5b49110518a03fa7d10a436d8c1ca396c
|
4
|
+
data.tar.gz: 5b99332dbafc318d5db5b4de03f09654b35b4108c7e126f2132db9e74d872d6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15ec712879343b5ab4ebb39d085a29e55d5ad51efd30fb2d294d0bea9e90d483b82a8093d9d00c25572bac3b9f6c25733e2099066f39914192d49baee3b449dc
|
7
|
+
data.tar.gz: 50092cb860beb679e653e457b11ceb169ae588511d82308243cb32fcc0e33f13e00ca5196971cfaf583e25534c5370ec8a592b1d1df132d230ed8d951aabcf3c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.6.0.pre.3 (2024-09-30)
|
4
|
+
|
5
|
+
### Signature updates
|
6
|
+
|
7
|
+
* `JSON.load_file`, `.load_file!` ([#2031](https://github.com/ruby/rbs/pull/2031))
|
8
|
+
* `Module#class_eval`, `Module#module_eval` ([#2029](https://github.com/ruby/rbs/pull/2029))
|
9
|
+
* `Open3` ([#2014](https://github.com/ruby/rbs/pull/2014))
|
10
|
+
* `RubyVM::InstructionSequence` ([#2027](https://github.com/ruby/rbs/pull/2027))
|
11
|
+
* Fixup RBS type definitions with rbs-on-rubocop ([#2023](https://github.com/ruby/rbs/pull/2023))
|
12
|
+
* Avoid using `instance`/`class` types in modules ([#2020](https://github.com/ruby/rbs/pull/2020))
|
13
|
+
|
14
|
+
### Language updates
|
15
|
+
|
16
|
+
* Optional type param restriction ([#2030](https://github.com/ruby/rbs/pull/2030))
|
17
|
+
* Prohibit `self` type as a generics default ([#2022](https://github.com/ruby/rbs/pull/2022))
|
18
|
+
* Allow `self` types in generics default type ([#2021](https://github.com/ruby/rbs/pull/2021))
|
19
|
+
|
20
|
+
### Library changes
|
21
|
+
|
22
|
+
* Add `TypeParamDefaultReferenceError#type_param` ([#2032](https://github.com/ruby/rbs/pull/2032))
|
23
|
+
|
24
|
+
## 3.6.0.pre.2 (2024-09-18)
|
25
|
+
|
26
|
+
### Signature updates
|
27
|
+
|
28
|
+
* `Kernel#class` ([#2017](https://github.com/ruby/rbs/pull/2017))
|
29
|
+
* `TracePoint#enable` ([#2015](https://github.com/ruby/rbs/pull/2015))
|
30
|
+
|
31
|
+
### Miscellaneous
|
32
|
+
|
33
|
+
* Fix type definition and type errors ([#2016](https://github.com/ruby/rbs/pull/2016))
|
34
|
+
|
3
35
|
## 3.6.0.pre.1 (2024-09-17)
|
4
36
|
|
5
37
|
### Signature updates
|
data/Rakefile
CHANGED
@@ -56,7 +56,7 @@ end
|
|
56
56
|
task :validate => :compile do
|
57
57
|
require 'yaml'
|
58
58
|
|
59
|
-
sh "#{ruby} #{rbs} validate"
|
59
|
+
sh "#{ruby} #{rbs} validate --exit-error-on-syntax-error"
|
60
60
|
|
61
61
|
libs = FileList["stdlib/*"].map {|path| File.basename(path).to_s }
|
62
62
|
|
@@ -72,7 +72,7 @@ task :validate => :compile do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
libs.each do |lib|
|
75
|
-
sh "#{ruby} #{rbs} -r #{lib} validate"
|
75
|
+
sh "#{ruby} #{rbs} -r #{lib} validate --exit-error-on-syntax-error"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
data/core/array.rbs
CHANGED
data/core/complex.rbs
CHANGED
data/core/data.rbs
CHANGED
data/core/dir.rbs
CHANGED
data/core/encoding.rbs
CHANGED
data/core/enumerator/product.rbs
CHANGED
data/core/enumerator.rbs
CHANGED
@@ -132,7 +132,7 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
|
|
132
132
|
|
133
133
|
# A convenience interface for `each` with optional block
|
134
134
|
#
|
135
|
-
interface _Each[out E, out R
|
135
|
+
interface _Each[out E, out R]
|
136
136
|
def each: () { (E) -> void } -> R
|
137
137
|
| () -> Enumerator[E, R]
|
138
138
|
end
|
data/core/errors.rbs
CHANGED
@@ -270,8 +270,6 @@ class NameError[T] < StandardError
|
|
270
270
|
#
|
271
271
|
def initialize: (?string msg, ?String? name, ?receiver: T?) -> void
|
272
272
|
|
273
|
-
public
|
274
|
-
|
275
273
|
# <!--
|
276
274
|
# rdoc-file=error.c
|
277
275
|
# - name_error.local_variables -> array
|
@@ -362,8 +360,6 @@ class NoMethodError[T] < NameError[T]
|
|
362
360
|
#
|
363
361
|
def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?boolish `private`, ?receiver: T?) -> void
|
364
362
|
|
365
|
-
public
|
366
|
-
|
367
363
|
# <!--
|
368
364
|
# rdoc-file=error.c
|
369
365
|
# - no_method_error.args -> obj
|
@@ -471,8 +467,6 @@ class SignalException < Exception
|
|
471
467
|
def initialize: (?string sig_name) -> void
|
472
468
|
| (int sig_number, ?string sig_name) -> void
|
473
469
|
|
474
|
-
public
|
475
|
-
|
476
470
|
def signm: () -> String
|
477
471
|
|
478
472
|
# <!--
|
@@ -608,8 +602,6 @@ class SystemCallError < StandardError
|
|
608
602
|
#
|
609
603
|
def self.===: (untyped other) -> bool
|
610
604
|
|
611
|
-
public
|
612
|
-
|
613
605
|
# <!--
|
614
606
|
# rdoc-file=error.c
|
615
607
|
# - system_call_error.errno -> integer
|
@@ -637,8 +629,6 @@ class SystemExit < Exception
|
|
637
629
|
| (string msg) -> void
|
638
630
|
| (true | false | int status, ?string msg) -> void
|
639
631
|
|
640
|
-
public
|
641
|
-
|
642
632
|
# <!--
|
643
633
|
# rdoc-file=error.c
|
644
634
|
# - system_exit.status -> integer
|
@@ -726,8 +716,6 @@ class UncaughtThrowError < ArgumentError
|
|
726
716
|
#
|
727
717
|
def initialize: (untyped tag, untyped value) -> void
|
728
718
|
|
729
|
-
public
|
730
|
-
|
731
719
|
# <!--
|
732
720
|
# rdoc-file=vm_eval.c
|
733
721
|
# - uncaught_throw.tag -> obj
|
data/core/file.rbs
CHANGED
data/core/float.rbs
CHANGED
data/core/hash.rbs
CHANGED
@@ -559,8 +559,6 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
559
559
|
def self.try_convert: [U, V] (_ToHash[U, V]) -> ::Hash[U, V]
|
560
560
|
| (untyped) -> (::Hash[untyped, untyped] | nil)
|
561
561
|
|
562
|
-
public
|
563
|
-
|
564
562
|
# <!--
|
565
563
|
# rdoc-file=hash.c
|
566
564
|
# - hash < other_hash -> true or false
|
data/core/integer.rbs
CHANGED
data/core/io/buffer.rbs
CHANGED
data/core/kernel.rbs
CHANGED
@@ -2210,7 +2210,7 @@ module Kernel : BasicObject
|
|
2210
2210
|
# s3 = s1.dup #=> #<Klass:0x401c1084>
|
2211
2211
|
# s3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401c1084>
|
2212
2212
|
#
|
2213
|
-
def dup: () ->
|
2213
|
+
def dup: () -> self
|
2214
2214
|
|
2215
2215
|
# <!-- rdoc-file=enumerator.c -->
|
2216
2216
|
# Creates a new Enumerator which will enumerate by calling `method` on `obj`,
|
@@ -2956,9 +2956,9 @@ module Kernel : BasicObject
|
|
2956
2956
|
|
2957
2957
|
private
|
2958
2958
|
|
2959
|
-
def initialize_copy: (
|
2959
|
+
def initialize_copy: (self object) -> self
|
2960
2960
|
|
2961
|
-
def initialize_clone: (
|
2961
|
+
def initialize_clone: (self object, ?freeze: bool?) -> self
|
2962
2962
|
|
2963
|
-
def initialize_dup: (
|
2963
|
+
def initialize_dup: (self object) -> self
|
2964
2964
|
end
|
data/core/module.rbs
CHANGED
@@ -377,7 +377,7 @@ class Module < Object
|
|
377
377
|
# or method `code' for Thing:Class
|
378
378
|
#
|
379
379
|
def class_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
|
380
|
-
| [U] () { (self m) -> U } -> U
|
380
|
+
| [U] () { (self m) [self: self] -> U } -> U
|
381
381
|
|
382
382
|
# <!-- rdoc-file=vm_eval.c -->
|
383
383
|
# Evaluates the given block in the context of the class/module. The method
|
@@ -1083,7 +1083,7 @@ class Module < Object
|
|
1083
1083
|
# or method `code' for Thing:Class
|
1084
1084
|
#
|
1085
1085
|
def module_eval: (String arg0, ?String filename, ?Integer lineno) -> untyped
|
1086
|
-
| [U] () { (self m) -> U } -> U
|
1086
|
+
| [U] () { (self m) [self: self] -> U } -> U
|
1087
1087
|
|
1088
1088
|
# <!--
|
1089
1089
|
# rdoc-file=vm_eval.c
|
data/core/numeric.rbs
CHANGED
data/core/ractor.rbs
CHANGED
@@ -597,8 +597,6 @@ class Ractor
|
|
597
597
|
#
|
598
598
|
def self.yield: (untyped obj, ?move: boolish) -> untyped
|
599
599
|
|
600
|
-
public
|
601
|
-
|
602
600
|
# <!--
|
603
601
|
# rdoc-file=ractor.rb
|
604
602
|
# - <<(obj, move: false)
|
@@ -925,8 +923,6 @@ class Ractor
|
|
925
923
|
# # Ractor::MovedError (can not send any methods to a moved object)
|
926
924
|
#
|
927
925
|
class MovedObject < BasicObject
|
928
|
-
public
|
929
|
-
|
930
926
|
# <!--
|
931
927
|
# rdoc-file=ractor.c
|
932
928
|
# - !(*args)
|
@@ -1007,8 +1003,6 @@ class Ractor
|
|
1007
1003
|
# end
|
1008
1004
|
#
|
1009
1005
|
class RemoteError < Ractor::Error
|
1010
|
-
public
|
1011
|
-
|
1012
1006
|
def ractor: () -> Ractor
|
1013
1007
|
end
|
1014
1008
|
|
data/core/rational.rbs
CHANGED
data/core/rbs/unnamed/argf.rbs
CHANGED
data/core/ruby_vm.rbs
CHANGED
@@ -50,6 +50,311 @@ RubyVM::OPTS: Array[String]
|
|
50
50
|
# Of course, this class is MRI specific.
|
51
51
|
#
|
52
52
|
class RubyVM::InstructionSequence < Object
|
53
|
+
# <!--
|
54
|
+
# rdoc-file=iseq.c
|
55
|
+
# - absolute_path()
|
56
|
+
# -->
|
57
|
+
# Returns the absolute path of this instruction sequence.
|
58
|
+
#
|
59
|
+
# `nil` if the iseq was evaluated from a string.
|
60
|
+
#
|
61
|
+
# For example, using ::compile_file:
|
62
|
+
#
|
63
|
+
# # /tmp/method.rb
|
64
|
+
# def hello
|
65
|
+
# puts "hello, world"
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# # in irb
|
69
|
+
# > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
70
|
+
# > iseq.absolute_path #=> /tmp/method.rb
|
71
|
+
#
|
72
|
+
def absolute_path: () -> String?
|
73
|
+
|
74
|
+
# <!--
|
75
|
+
# rdoc-file=iseq.c
|
76
|
+
# - base_label()
|
77
|
+
# -->
|
78
|
+
# Returns the base label of this instruction sequence.
|
79
|
+
#
|
80
|
+
# For example, using irb:
|
81
|
+
#
|
82
|
+
# iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
83
|
+
# #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
84
|
+
# iseq.base_label
|
85
|
+
# #=> "<compiled>"
|
86
|
+
#
|
87
|
+
# Using ::compile_file:
|
88
|
+
#
|
89
|
+
# # /tmp/method.rb
|
90
|
+
# def hello
|
91
|
+
# puts "hello, world"
|
92
|
+
# end
|
93
|
+
#
|
94
|
+
# # in irb
|
95
|
+
# > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
96
|
+
# > iseq.base_label #=> <main>
|
97
|
+
#
|
98
|
+
def base_label: () -> String
|
99
|
+
|
100
|
+
# <!--
|
101
|
+
# rdoc-file=iseq.c
|
102
|
+
# - iseq.disasm -> str
|
103
|
+
# - iseq.disassemble -> str
|
104
|
+
# -->
|
105
|
+
# Returns the instruction sequence as a `String` in human readable form.
|
106
|
+
#
|
107
|
+
# puts RubyVM::InstructionSequence.compile('1 + 2').disasm
|
108
|
+
#
|
109
|
+
# Produces:
|
110
|
+
#
|
111
|
+
# == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
|
112
|
+
# 0000 trace 1 ( 1)
|
113
|
+
# 0002 putobject 1
|
114
|
+
# 0004 putobject 2
|
115
|
+
# 0006 opt_plus <ic:1>
|
116
|
+
# 0008 leave
|
117
|
+
#
|
118
|
+
def disasm: () -> String
|
119
|
+
|
120
|
+
# <!-- rdoc-file=iseq.c -->
|
121
|
+
# Returns the instruction sequence as a `String` in human readable form.
|
122
|
+
#
|
123
|
+
# puts RubyVM::InstructionSequence.compile('1 + 2').disasm
|
124
|
+
#
|
125
|
+
# Produces:
|
126
|
+
#
|
127
|
+
# == disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
|
128
|
+
# 0000 trace 1 ( 1)
|
129
|
+
# 0002 putobject 1
|
130
|
+
# 0004 putobject 2
|
131
|
+
# 0006 opt_plus <ic:1>
|
132
|
+
# 0008 leave
|
133
|
+
#
|
134
|
+
def disassemble: () -> String
|
135
|
+
|
136
|
+
# <!--
|
137
|
+
# rdoc-file=iseq.c
|
138
|
+
# - iseq.each_child{|child_iseq| ...} -> iseq
|
139
|
+
# -->
|
140
|
+
# Iterate all direct child instruction sequences. Iteration order is
|
141
|
+
# implementation/version defined so that people should not rely on the order.
|
142
|
+
#
|
143
|
+
def each_child: () -> RubyVM::InstructionSequence
|
144
|
+
|
145
|
+
# <!--
|
146
|
+
# rdoc-file=iseq.c
|
147
|
+
# - iseq.eval -> obj
|
148
|
+
# -->
|
149
|
+
# Evaluates the instruction sequence and returns the result.
|
150
|
+
#
|
151
|
+
# RubyVM::InstructionSequence.compile("1 + 2").eval #=> 3
|
152
|
+
#
|
153
|
+
def eval: () -> untyped
|
154
|
+
|
155
|
+
# <!--
|
156
|
+
# rdoc-file=iseq.c
|
157
|
+
# - first_lineno()
|
158
|
+
# -->
|
159
|
+
# Returns the number of the first source line where the instruction sequence was
|
160
|
+
# loaded from.
|
161
|
+
#
|
162
|
+
# For example, using irb:
|
163
|
+
#
|
164
|
+
# iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
165
|
+
# #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
166
|
+
# iseq.first_lineno
|
167
|
+
# #=> 1
|
168
|
+
#
|
169
|
+
def first_lineno: () -> Integer
|
170
|
+
|
171
|
+
# <!--
|
172
|
+
# rdoc-file=iseq.c
|
173
|
+
# - inspect()
|
174
|
+
# -->
|
175
|
+
# Returns a human-readable string representation of this instruction sequence,
|
176
|
+
# including the #label and #path.
|
177
|
+
#
|
178
|
+
def inspect: () -> String
|
179
|
+
|
180
|
+
# <!--
|
181
|
+
# rdoc-file=iseq.c
|
182
|
+
# - label()
|
183
|
+
# -->
|
184
|
+
# Returns the label of this instruction sequence.
|
185
|
+
#
|
186
|
+
# `<main>` if it's at the top level, `<compiled>` if it was evaluated from a
|
187
|
+
# string.
|
188
|
+
#
|
189
|
+
# For example, using irb:
|
190
|
+
#
|
191
|
+
# iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
192
|
+
# #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
193
|
+
# iseq.label
|
194
|
+
# #=> "<compiled>"
|
195
|
+
#
|
196
|
+
# Using ::compile_file:
|
197
|
+
#
|
198
|
+
# # /tmp/method.rb
|
199
|
+
# def hello
|
200
|
+
# puts "hello, world"
|
201
|
+
# end
|
202
|
+
#
|
203
|
+
# # in irb
|
204
|
+
# > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
205
|
+
# > iseq.label #=> <main>
|
206
|
+
#
|
207
|
+
def label: () -> String
|
208
|
+
|
209
|
+
# <!--
|
210
|
+
# rdoc-file=iseq.c
|
211
|
+
# - path()
|
212
|
+
# -->
|
213
|
+
# Returns the path of this instruction sequence.
|
214
|
+
#
|
215
|
+
# `<compiled>` if the iseq was evaluated from a string.
|
216
|
+
#
|
217
|
+
# For example, using irb:
|
218
|
+
#
|
219
|
+
# iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
|
220
|
+
# #=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
|
221
|
+
# iseq.path
|
222
|
+
# #=> "<compiled>"
|
223
|
+
#
|
224
|
+
# Using ::compile_file:
|
225
|
+
#
|
226
|
+
# # /tmp/method.rb
|
227
|
+
# def hello
|
228
|
+
# puts "hello, world"
|
229
|
+
# end
|
230
|
+
#
|
231
|
+
# # in irb
|
232
|
+
# > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
|
233
|
+
# > iseq.path #=> /tmp/method.rb
|
234
|
+
#
|
235
|
+
def path: () -> String
|
236
|
+
|
237
|
+
# <!--
|
238
|
+
# rdoc-file=iseq.c
|
239
|
+
# - iseq.script_lines -> array or nil
|
240
|
+
# -->
|
241
|
+
# It returns recorded script lines if it is available. The script lines are not
|
242
|
+
# limited to the iseq range, but are entire lines of the source file.
|
243
|
+
#
|
244
|
+
# Note that this is an API for ruby internal use, debugging, and research. Do
|
245
|
+
# not use this for any other purpose. The compatibility is not guaranteed.
|
246
|
+
#
|
247
|
+
def script_lines: () -> Array[String]?
|
248
|
+
|
249
|
+
# <!--
|
250
|
+
# rdoc-file=iseq.c
|
251
|
+
# - iseq.to_a -> ary
|
252
|
+
# -->
|
253
|
+
# Returns an Array with 14 elements representing the instruction sequence with
|
254
|
+
# the following data:
|
255
|
+
#
|
256
|
+
# magic
|
257
|
+
# : A string identifying the data format. **Always
|
258
|
+
# `YARVInstructionSequence/SimpleDataFormat`.**
|
259
|
+
#
|
260
|
+
# major_version
|
261
|
+
# : The major version of the instruction sequence.
|
262
|
+
#
|
263
|
+
# minor_version
|
264
|
+
# : The minor version of the instruction sequence.
|
265
|
+
#
|
266
|
+
# format_type
|
267
|
+
# : A number identifying the data format. **Always 1**.
|
268
|
+
#
|
269
|
+
# misc
|
270
|
+
# : A hash containing:
|
271
|
+
#
|
272
|
+
# `:arg_size`
|
273
|
+
# : the total number of arguments taken by the method or the block (0 if
|
274
|
+
# *iseq* doesn't represent a method or block)
|
275
|
+
# `:local_size`
|
276
|
+
# : the number of local variables + 1
|
277
|
+
# `:stack_max`
|
278
|
+
# : used in calculating the stack depth at which a SystemStackError is
|
279
|
+
# thrown.
|
280
|
+
#
|
281
|
+
#
|
282
|
+
# #label
|
283
|
+
# : The name of the context (block, method, class, module, etc.) that this
|
284
|
+
# instruction sequence belongs to.
|
285
|
+
#
|
286
|
+
# `<main>` if it's at the top level, `<compiled>` if it was evaluated from a
|
287
|
+
# string.
|
288
|
+
#
|
289
|
+
# #path
|
290
|
+
# : The relative path to the Ruby file where the instruction sequence was
|
291
|
+
# loaded from.
|
292
|
+
#
|
293
|
+
# `<compiled>` if the iseq was evaluated from a string.
|
294
|
+
#
|
295
|
+
# #absolute_path
|
296
|
+
# : The absolute path to the Ruby file where the instruction sequence was
|
297
|
+
# loaded from.
|
298
|
+
#
|
299
|
+
# `nil` if the iseq was evaluated from a string.
|
300
|
+
#
|
301
|
+
# #first_lineno
|
302
|
+
# : The number of the first source line where the instruction sequence was
|
303
|
+
# loaded from.
|
304
|
+
#
|
305
|
+
# type
|
306
|
+
# : The type of the instruction sequence.
|
307
|
+
#
|
308
|
+
# Valid values are `:top`, `:method`, `:block`, `:class`, `:rescue`,
|
309
|
+
# `:ensure`, `:eval`, `:main`, and `plain`.
|
310
|
+
#
|
311
|
+
# locals
|
312
|
+
# : An array containing the names of all arguments and local variables as
|
313
|
+
# symbols.
|
314
|
+
#
|
315
|
+
# params
|
316
|
+
# : An Hash object containing parameter information.
|
317
|
+
#
|
318
|
+
# More info about these values can be found in `vm_core.h`.
|
319
|
+
#
|
320
|
+
# catch_table
|
321
|
+
# : A list of exceptions and control flow operators (rescue, next, redo,
|
322
|
+
# break, etc.).
|
323
|
+
#
|
324
|
+
# bytecode
|
325
|
+
# : An array of arrays containing the instruction names and operands that make
|
326
|
+
# up the body of the instruction sequence.
|
327
|
+
#
|
328
|
+
#
|
329
|
+
# Note that this format is MRI specific and version dependent.
|
330
|
+
#
|
331
|
+
def to_a: () -> Array[untyped]
|
332
|
+
|
333
|
+
# <!--
|
334
|
+
# rdoc-file=iseq.c
|
335
|
+
# - iseq.to_binary(extra_data = nil) -> binary str
|
336
|
+
# -->
|
337
|
+
# Returns serialized iseq binary format data as a String object. A corresponding
|
338
|
+
# iseq object is created by RubyVM::InstructionSequence.load_from_binary()
|
339
|
+
# method.
|
340
|
+
#
|
341
|
+
# String extra_data will be saved with binary data. You can access this data
|
342
|
+
# with RubyVM::InstructionSequence.load_from_binary_extra_data(binary).
|
343
|
+
#
|
344
|
+
# Note that the translated binary data is not portable. You can not move this
|
345
|
+
# binary data to another machine. You can not use the binary data which is
|
346
|
+
# created by another version/another architecture of Ruby.
|
347
|
+
#
|
348
|
+
def to_binary: () -> String
|
349
|
+
|
350
|
+
# <!--
|
351
|
+
# rdoc-file=iseq.c
|
352
|
+
# - iseq.trace_points -> ary
|
353
|
+
# -->
|
354
|
+
# Return trace points in the instruction sequence. Return an array of [line,
|
355
|
+
# event_symbol] pair.
|
356
|
+
#
|
357
|
+
def trace_points: () -> Array[untyped]
|
53
358
|
end
|
54
359
|
|
55
360
|
# <!-- rdoc-file=ast.rb -->
|
data/core/trace_point.rbs
CHANGED
@@ -352,8 +352,8 @@ class TracePoint
|
|
352
352
|
# trace.enable { p tp.lineno }
|
353
353
|
# #=> RuntimeError: access from outside
|
354
354
|
#
|
355
|
-
def enable: (?target: Method | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) -> bool
|
356
|
-
| [T] (?target: Method | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) { () -> T } -> T
|
355
|
+
def enable: (?target: Method | UnboundMethod | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) -> bool
|
356
|
+
| [T] (?target: Method | UnboundMethod | RubyVM::InstructionSequence | Proc | nil, ?target_line: int?, ?target_thread: Thread | :default | nil) { () -> T } -> T
|
357
357
|
|
358
358
|
# <!--
|
359
359
|
# rdoc-file=trace_point.rb
|