steep 0.16.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +0 -3
- data/CHANGELOG.md +6 -0
- data/Rakefile +0 -13
- data/bin/setup +0 -2
- data/bin/smoke_runner.rb +0 -1
- data/exe/steep +0 -1
- data/lib/steep/project/file.rb +1 -1
- data/lib/steep/project/hover_content.rb +1 -1
- data/lib/steep/server/code_worker.rb +1 -1
- data/lib/steep/server/signature_worker.rb +4 -4
- data/lib/steep/type_construction.rb +10 -16
- data/lib/steep/type_inference/constant_env.rb +2 -10
- data/lib/steep/type_inference/context.rb +1 -0
- data/lib/steep/version.rb +1 -1
- data/steep.gemspec +1 -5
- metadata +17 -135
- data/exe/rbs +0 -3
- data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
- data/vendor/ruby-signature/.gitignore +0 -12
- data/vendor/ruby-signature/.rubocop.yml +0 -15
- data/vendor/ruby-signature/BSDL +0 -22
- data/vendor/ruby-signature/COPYING +0 -56
- data/vendor/ruby-signature/Gemfile +0 -6
- data/vendor/ruby-signature/README.md +0 -93
- data/vendor/ruby-signature/Rakefile +0 -142
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
- data/vendor/ruby-signature/bin/console +0 -14
- data/vendor/ruby-signature/bin/query-rdoc +0 -103
- data/vendor/ruby-signature/bin/setup +0 -10
- data/vendor/ruby-signature/bin/sort +0 -89
- data/vendor/ruby-signature/bin/test_runner.rb +0 -16
- data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
- data/vendor/ruby-signature/docs/sigs.md +0 -148
- data/vendor/ruby-signature/docs/stdlib.md +0 -152
- data/vendor/ruby-signature/docs/syntax.md +0 -528
- data/vendor/ruby-signature/exe/rbs +0 -7
- data/vendor/ruby-signature/lib/rbs.rb +0 -64
- data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
- data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
- data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
- data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
- data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
- data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
- data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
- data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
- data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
- data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
- data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
- data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
- data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
- data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
- data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
- data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
- data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
- data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
- data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
- data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
- data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
- data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
- data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
- data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
- data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
- data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
- data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
- data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
- data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
- data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
- data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
- data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
- data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
- data/vendor/ruby-signature/rbs.gemspec +0 -46
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
- data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
- data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
- data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
- data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
- data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
- data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
- data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
- data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
- data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
- data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
- data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
- data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
- data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
- data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
- data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
- data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
- data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
- data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
- data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
- data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
- data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
- data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
- data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
- data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
- data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
- data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
- data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
- data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
- data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
- data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
- data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
- data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
- data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
- data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
- data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
- data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
- data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
- data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
- data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
- data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
- data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,362 +0,0 @@
|
|
1
|
-
module RBS
|
2
|
-
module AST
|
3
|
-
module Members
|
4
|
-
class MethodDefinition
|
5
|
-
attr_reader :name
|
6
|
-
attr_reader :kind
|
7
|
-
attr_reader :types
|
8
|
-
attr_reader :annotations
|
9
|
-
attr_reader :location
|
10
|
-
attr_reader :comment
|
11
|
-
attr_reader :attributes
|
12
|
-
|
13
|
-
def initialize(name:, kind:, types:, annotations:, location:, comment:, attributes:)
|
14
|
-
@name = name
|
15
|
-
@kind = kind
|
16
|
-
@types = types
|
17
|
-
@annotations = annotations
|
18
|
-
@location = location
|
19
|
-
@comment = comment
|
20
|
-
@attributes = attributes
|
21
|
-
end
|
22
|
-
|
23
|
-
def ==(other)
|
24
|
-
other.is_a?(MethodDefinition) &&
|
25
|
-
other.name == name &&
|
26
|
-
other.kind == kind &&
|
27
|
-
other.types == types &&
|
28
|
-
other.attributes == attributes
|
29
|
-
end
|
30
|
-
|
31
|
-
alias eql? ==
|
32
|
-
|
33
|
-
def hash
|
34
|
-
self.class.hash ^ name.hash ^ kind.hash ^ types.hash ^ attributes.hash
|
35
|
-
end
|
36
|
-
|
37
|
-
def instance?
|
38
|
-
kind == :instance || kind == :singleton_instance
|
39
|
-
end
|
40
|
-
|
41
|
-
def singleton?
|
42
|
-
kind == :singleton || kind == :singleton_instance
|
43
|
-
end
|
44
|
-
|
45
|
-
def to_json(*a)
|
46
|
-
{
|
47
|
-
member: :method_definition,
|
48
|
-
kind: kind,
|
49
|
-
types: types,
|
50
|
-
annotations: annotations,
|
51
|
-
location: location,
|
52
|
-
comment: comment,
|
53
|
-
attributes: attributes
|
54
|
-
}.to_json(*a)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
module Var
|
59
|
-
attr_reader :name
|
60
|
-
attr_reader :type
|
61
|
-
attr_reader :location
|
62
|
-
attr_reader :comment
|
63
|
-
|
64
|
-
def initialize(name:, type:, location:, comment:)
|
65
|
-
@name = name
|
66
|
-
@type = type
|
67
|
-
@location = location
|
68
|
-
@comment = comment
|
69
|
-
end
|
70
|
-
|
71
|
-
def ==(other)
|
72
|
-
other.is_a?(self.class) && other.name == name && other.type == type
|
73
|
-
end
|
74
|
-
|
75
|
-
alias eql? ==
|
76
|
-
|
77
|
-
def hash
|
78
|
-
self.class.hash ^ name.hash ^ type.hash
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
class InstanceVariable
|
83
|
-
include Var
|
84
|
-
|
85
|
-
def to_json(*a)
|
86
|
-
{
|
87
|
-
member: :instance_variable,
|
88
|
-
name: name,
|
89
|
-
type: type,
|
90
|
-
location: location,
|
91
|
-
comment: comment
|
92
|
-
}.to_json(*a)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
class ClassInstanceVariable
|
97
|
-
include Var
|
98
|
-
|
99
|
-
def to_json(*a)
|
100
|
-
{
|
101
|
-
member: :class_instance_variable,
|
102
|
-
name: name,
|
103
|
-
type: type,
|
104
|
-
location: location,
|
105
|
-
comment: comment
|
106
|
-
}.to_json(*a)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
class ClassVariable
|
111
|
-
include Var
|
112
|
-
|
113
|
-
def to_json(*a)
|
114
|
-
{
|
115
|
-
member: :class_variable,
|
116
|
-
name: name,
|
117
|
-
type: type,
|
118
|
-
location: location,
|
119
|
-
comment: comment
|
120
|
-
}.to_json(*a)
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
module Mixin
|
125
|
-
attr_reader :name
|
126
|
-
attr_reader :args
|
127
|
-
attr_reader :annotations
|
128
|
-
attr_reader :location
|
129
|
-
attr_reader :comment
|
130
|
-
|
131
|
-
def initialize(name:, args:, annotations:, location:, comment:)
|
132
|
-
@name = name
|
133
|
-
@args = args
|
134
|
-
@annotations = annotations
|
135
|
-
@location = location
|
136
|
-
@comment = comment
|
137
|
-
end
|
138
|
-
|
139
|
-
def ==(other)
|
140
|
-
other.is_a?(self.class) && other.name == name && other.args == args
|
141
|
-
end
|
142
|
-
|
143
|
-
def eql?(other)
|
144
|
-
self == other
|
145
|
-
end
|
146
|
-
|
147
|
-
def hash
|
148
|
-
self.class.hash ^ name.hash ^ args.hash
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
class Include
|
153
|
-
include Mixin
|
154
|
-
|
155
|
-
def to_json(*a)
|
156
|
-
{
|
157
|
-
member: :include,
|
158
|
-
name: name,
|
159
|
-
args: args,
|
160
|
-
annotations: annotations,
|
161
|
-
location: location,
|
162
|
-
comment: comment
|
163
|
-
}.to_json(*a)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
class Extend
|
168
|
-
include Mixin
|
169
|
-
|
170
|
-
def to_json(*a)
|
171
|
-
{
|
172
|
-
member: :extend,
|
173
|
-
name: name,
|
174
|
-
args: args,
|
175
|
-
annotations: annotations,
|
176
|
-
location: location,
|
177
|
-
comment: comment
|
178
|
-
}.to_json(*a)
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
class Prepend
|
183
|
-
include Mixin
|
184
|
-
|
185
|
-
def to_json(*a)
|
186
|
-
{
|
187
|
-
member: :prepend,
|
188
|
-
name: name,
|
189
|
-
args: args,
|
190
|
-
annotations: annotations,
|
191
|
-
location: location,
|
192
|
-
comment: comment
|
193
|
-
}.to_json(*a)
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
module Attribute
|
198
|
-
attr_reader :name
|
199
|
-
attr_reader :type
|
200
|
-
attr_reader :ivar_name
|
201
|
-
attr_reader :annotations
|
202
|
-
attr_reader :location
|
203
|
-
attr_reader :comment
|
204
|
-
|
205
|
-
def initialize(name:, type:, ivar_name:, annotations:, location:, comment:)
|
206
|
-
@name = name
|
207
|
-
@type = type
|
208
|
-
@ivar_name = ivar_name
|
209
|
-
@annotations = annotations
|
210
|
-
@location = location
|
211
|
-
@comment = comment
|
212
|
-
end
|
213
|
-
|
214
|
-
def ==(other)
|
215
|
-
other.is_a?(self.class) &&
|
216
|
-
other.name == name &&
|
217
|
-
other.type == type &&
|
218
|
-
other.ivar_name == ivar_name
|
219
|
-
end
|
220
|
-
|
221
|
-
alias eql? ==
|
222
|
-
|
223
|
-
def hash
|
224
|
-
self.class.hash ^ name.hash ^ type.hash ^ ivar_name.hash
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
class AttrReader
|
229
|
-
include Attribute
|
230
|
-
|
231
|
-
def to_json(*a)
|
232
|
-
{
|
233
|
-
member: :attr_reader,
|
234
|
-
name: name,
|
235
|
-
type: type,
|
236
|
-
ivar_name: ivar_name,
|
237
|
-
annotations: annotations,
|
238
|
-
location: location,
|
239
|
-
comment: comment
|
240
|
-
}.to_json(*a)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
class AttrAccessor
|
245
|
-
include Attribute
|
246
|
-
|
247
|
-
def to_json(*a)
|
248
|
-
{
|
249
|
-
member: :attr_accessor,
|
250
|
-
name: name,
|
251
|
-
type: type,
|
252
|
-
ivar_name: ivar_name,
|
253
|
-
annotations: annotations,
|
254
|
-
location: location,
|
255
|
-
comment: comment
|
256
|
-
}.to_json(*a)
|
257
|
-
end
|
258
|
-
end
|
259
|
-
|
260
|
-
class AttrWriter
|
261
|
-
include Attribute
|
262
|
-
|
263
|
-
def to_json(*a)
|
264
|
-
{
|
265
|
-
member: :attr_writer,
|
266
|
-
name: name,
|
267
|
-
type: type,
|
268
|
-
ivar_name: ivar_name,
|
269
|
-
annotations: annotations,
|
270
|
-
location: location,
|
271
|
-
comment: comment
|
272
|
-
}.to_json(*a)
|
273
|
-
end
|
274
|
-
end
|
275
|
-
|
276
|
-
module LocationOnly
|
277
|
-
attr_reader :location
|
278
|
-
|
279
|
-
def initialize(location:)
|
280
|
-
@location = location
|
281
|
-
end
|
282
|
-
|
283
|
-
def ==(other)
|
284
|
-
other.is_a?(self.class)
|
285
|
-
end
|
286
|
-
|
287
|
-
alias eql? ==
|
288
|
-
|
289
|
-
def hash
|
290
|
-
self.class.hash
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
class Public
|
295
|
-
include LocationOnly
|
296
|
-
|
297
|
-
def to_json(*a)
|
298
|
-
{ member: :public, location: location }.to_json(*a)
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
class Private
|
303
|
-
include LocationOnly
|
304
|
-
|
305
|
-
def to_json(*a)
|
306
|
-
{ member: :private, location: location }.to_json(*a)
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
class Alias
|
311
|
-
attr_reader :new_name
|
312
|
-
attr_reader :old_name
|
313
|
-
attr_reader :kind
|
314
|
-
attr_reader :annotations
|
315
|
-
attr_reader :location
|
316
|
-
attr_reader :comment
|
317
|
-
|
318
|
-
def initialize(new_name:, old_name:, kind:, annotations:, location:, comment:)
|
319
|
-
@new_name = new_name
|
320
|
-
@old_name = old_name
|
321
|
-
@kind = kind
|
322
|
-
@annotations = annotations
|
323
|
-
@location = location
|
324
|
-
@comment = comment
|
325
|
-
end
|
326
|
-
|
327
|
-
def ==(other)
|
328
|
-
other.is_a?(self.class) &&
|
329
|
-
other.new_name == new_name &&
|
330
|
-
other.old_name == old_name &&
|
331
|
-
other.kind == kind
|
332
|
-
end
|
333
|
-
|
334
|
-
alias eql? ==
|
335
|
-
|
336
|
-
def hash
|
337
|
-
self.class.hash ^ new_name.hash ^ old_name.hash ^ kind.hash
|
338
|
-
end
|
339
|
-
|
340
|
-
def to_json(*a)
|
341
|
-
{
|
342
|
-
member: :alias,
|
343
|
-
new_name: new_name,
|
344
|
-
old_name: old_name,
|
345
|
-
kind: kind,
|
346
|
-
annotations: annotations,
|
347
|
-
location: location,
|
348
|
-
comment: comment
|
349
|
-
}.to_json(*a)
|
350
|
-
end
|
351
|
-
|
352
|
-
def instance?
|
353
|
-
kind == :instance
|
354
|
-
end
|
355
|
-
|
356
|
-
def singleton?
|
357
|
-
kind == :singleton
|
358
|
-
end
|
359
|
-
end
|
360
|
-
end
|
361
|
-
end
|
362
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module RBS
|
2
|
-
class Buffer
|
3
|
-
attr_reader :name
|
4
|
-
attr_reader :content
|
5
|
-
attr_reader :lines
|
6
|
-
attr_reader :ranges
|
7
|
-
|
8
|
-
def initialize(name:, content:)
|
9
|
-
@name = name
|
10
|
-
@content = content
|
11
|
-
|
12
|
-
@lines = content.lines
|
13
|
-
|
14
|
-
@ranges = []
|
15
|
-
offset = 0
|
16
|
-
lines.each do |line|
|
17
|
-
size = line.size
|
18
|
-
range = offset...(offset+size)
|
19
|
-
ranges << range
|
20
|
-
offset += size
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def pos_to_loc(pos)
|
25
|
-
index = ranges.bsearch_index do |range|
|
26
|
-
pos < range.end
|
27
|
-
end
|
28
|
-
|
29
|
-
if index
|
30
|
-
[index + 1, pos - ranges[index].begin]
|
31
|
-
else
|
32
|
-
[ranges.size + 1, 0]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def loc_to_pos(loc)
|
37
|
-
line, column = loc
|
38
|
-
|
39
|
-
if range = ranges[line - 1]
|
40
|
-
range.begin + column
|
41
|
-
else
|
42
|
-
last_position
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def last_position
|
47
|
-
content.size
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
module RBS
|
2
|
-
module BuiltinNames
|
3
|
-
class Name
|
4
|
-
attr_reader :name
|
5
|
-
|
6
|
-
def initialize(name:)
|
7
|
-
@name = name
|
8
|
-
end
|
9
|
-
|
10
|
-
def to_s
|
11
|
-
name.to_s
|
12
|
-
end
|
13
|
-
|
14
|
-
def instance_type(*args)
|
15
|
-
Types::ClassInstance.new(name: name, args: args, location: nil)
|
16
|
-
end
|
17
|
-
|
18
|
-
def instance_type?(type)
|
19
|
-
type.is_a?(Types::ClassInstance) && type.name == name
|
20
|
-
end
|
21
|
-
|
22
|
-
def singleton_type
|
23
|
-
@singleton_type ||= Types::ClassSingleton.new(name: name, location: nil)
|
24
|
-
end
|
25
|
-
|
26
|
-
def singleton_type?(type)
|
27
|
-
type.is_a?(Types::ClassSingleton) && type.name == name
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.define(name, namespace: Namespace.root)
|
31
|
-
new(name: TypeName.new(name: name, namespace: namespace))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
BasicObject = Name.new(name: TypeName.new(name: :BasicObject, namespace: Namespace.root))
|
36
|
-
Object = Name.new(name: TypeName.new(name: :Object, namespace: Namespace.root))
|
37
|
-
Kernel = Name.new(name: TypeName.new(name: :Kernel, namespace: Namespace.root))
|
38
|
-
String = Name.define(:String)
|
39
|
-
Comparable = Name.define(:Comparable)
|
40
|
-
Enumerable = Name.define(:Enumerable)
|
41
|
-
Class = Name.define(:Class)
|
42
|
-
Module = Name.define(:Module)
|
43
|
-
Array = Name.define(:Array)
|
44
|
-
Hash = Name.define(:Hash)
|
45
|
-
Range = Name.define(:Range)
|
46
|
-
Enumerator = Name.define(:Enumerator)
|
47
|
-
Set = Name.define(:Set)
|
48
|
-
Symbol = Name.define(:Symbol)
|
49
|
-
Integer = Name.define(:Integer)
|
50
|
-
Float = Name.define(:Float)
|
51
|
-
Regexp = Name.define(:Regexp)
|
52
|
-
TrueClass = Name.define(:TrueClass)
|
53
|
-
FalseClass = Name.define(:FalseClass)
|
54
|
-
end
|
55
|
-
end
|