steep 0.14.0 → 0.16.3
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 +25 -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.rb +18 -2
- data/lib/steep/annotation_parser.rb +4 -4
- data/lib/steep/ast/buffer.rb +11 -7
- data/lib/steep/ast/builtin.rb +8 -0
- data/lib/steep/ast/types/factory.rb +55 -55
- data/lib/steep/cli.rb +16 -1
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/drivers/check.rb +20 -4
- data/lib/steep/drivers/langserver.rb +13 -457
- data/lib/steep/drivers/utils/driver_helper.rb +1 -1
- data/lib/steep/drivers/vendor.rb +2 -2
- data/lib/steep/drivers/watch.rb +97 -85
- data/lib/steep/drivers/worker.rb +51 -0
- data/lib/steep/project.rb +9 -5
- data/lib/steep/project/completion_provider.rb +9 -13
- data/lib/steep/project/dsl.rb +14 -0
- data/lib/steep/project/file.rb +43 -46
- data/lib/steep/project/hover_content.rb +17 -8
- data/lib/steep/project/options.rb +25 -3
- data/lib/steep/project/target.rb +40 -24
- data/lib/steep/server/base_worker.rb +56 -0
- data/lib/steep/server/code_worker.rb +151 -0
- data/lib/steep/server/interaction_worker.rb +281 -0
- data/lib/steep/server/master.rb +196 -0
- data/lib/steep/server/signature_worker.rb +148 -0
- data/lib/steep/server/utils.rb +36 -0
- data/lib/steep/server/worker_process.rb +62 -0
- data/lib/steep/signature/errors.rb +1 -1
- data/lib/steep/signature/validator.rb +13 -13
- data/lib/steep/source.rb +1 -1
- data/lib/steep/type_construction.rb +996 -726
- data/lib/steep/type_inference/constant_env.rb +3 -11
- data/lib/steep/type_inference/context.rb +8 -3
- data/lib/steep/type_inference/context_array.rb +111 -0
- data/lib/steep/type_inference/local_variable_type_env.rb +226 -0
- data/lib/steep/type_inference/logic.rb +130 -0
- data/lib/steep/type_inference/type_env.rb +5 -69
- data/lib/steep/typing.rb +79 -22
- data/lib/steep/version.rb +1 -1
- data/smoke/alias/Steepfile +1 -0
- data/smoke/and/Steepfile +1 -0
- data/smoke/array/Steepfile +1 -0
- data/smoke/array/b.rb +0 -2
- data/smoke/block/Steepfile +1 -0
- data/smoke/case/Steepfile +1 -0
- data/smoke/class/Steepfile +1 -0
- data/smoke/const/Steepfile +1 -0
- data/smoke/dstr/Steepfile +1 -0
- data/smoke/ensure/Steepfile +1 -0
- data/smoke/enumerator/Steepfile +1 -0
- data/smoke/extension/Steepfile +1 -0
- data/smoke/extension/c.rb +1 -0
- data/smoke/hash/Steepfile +1 -0
- data/smoke/hello/Steepfile +1 -0
- data/smoke/if/Steepfile +1 -0
- data/smoke/if/a.rb +1 -1
- data/smoke/implements/Steepfile +1 -0
- data/smoke/initialize/Steepfile +1 -0
- data/smoke/integer/Steepfile +1 -0
- data/smoke/interface/Steepfile +1 -0
- data/smoke/kwbegin/Steepfile +1 -0
- data/smoke/lambda/Steepfile +1 -0
- data/smoke/literal/Steepfile +1 -0
- data/smoke/map/Steepfile +1 -0
- data/smoke/method/Steepfile +1 -0
- data/smoke/module/Steepfile +1 -0
- data/smoke/regexp/Steepfile +1 -0
- data/smoke/regression/Steepfile +1 -0
- data/smoke/rescue/Steepfile +1 -0
- data/smoke/rescue/a.rb +1 -1
- data/smoke/self/Steepfile +1 -0
- data/smoke/skip/Steepfile +1 -0
- data/smoke/stdout/Steepfile +1 -0
- data/smoke/super/Steepfile +1 -0
- data/smoke/type_case/Steepfile +1 -0
- data/smoke/yield/Steepfile +1 -0
- data/steep.gemspec +7 -8
- metadata +26 -141
- data/exe/rbs +0 -3
- data/exe/ruby-signature +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 -67
- data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -156
- 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 -88
- data/vendor/ruby-signature/bin/test_runner.rb +0 -17
- 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 -3
- data/vendor/ruby-signature/exe/ruby-signature +0 -7
- data/vendor/ruby-signature/lib/ruby/signature.rb +0 -64
- data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +0 -29
- data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +0 -29
- data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +0 -391
- data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +0 -364
- data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +0 -52
- data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +0 -54
- data/vendor/ruby-signature/lib/ruby/signature/cli.rb +0 -555
- data/vendor/ruby-signature/lib/ruby/signature/constant.rb +0 -28
- data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +0 -152
- data/vendor/ruby-signature/lib/ruby/signature/definition.rb +0 -172
- data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +0 -921
- data/vendor/ruby-signature/lib/ruby/signature/environment.rb +0 -283
- data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +0 -138
- data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +0 -126
- data/vendor/ruby-signature/lib/ruby/signature/errors.rb +0 -189
- data/vendor/ruby-signature/lib/ruby/signature/location.rb +0 -104
- data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +0 -125
- data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +0 -93
- data/vendor/ruby-signature/lib/ruby/signature/parser.y +0 -1344
- data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +0 -444
- data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +0 -579
- data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +0 -383
- data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +0 -48
- data/vendor/ruby-signature/lib/ruby/signature/test.rb +0 -28
- data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +0 -63
- data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +0 -290
- data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +0 -58
- data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +0 -327
- data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +0 -185
- data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +0 -256
- data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +0 -72
- data/vendor/ruby-signature/lib/ruby/signature/types.rb +0 -932
- data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +0 -140
- data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +0 -49
- data/vendor/ruby-signature/lib/ruby/signature/version.rb +0 -5
- data/vendor/ruby-signature/lib/ruby/signature/writer.rb +0 -271
- data/vendor/ruby-signature/ruby-signature.gemspec +0 -45
- data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -3
- data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -15
- 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 -35
- 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 -419
- data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -606
- 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 -193
- 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 -476
- 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 -121
- data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
- data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -710
- data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
- data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -574
- data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -135
- data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
- data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -66
- data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -182
- data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -248
- 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 -426
- data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -354
- data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -93
- 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 -10
- 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 -1894
- data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -13
- data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
- data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -230
- data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1112
- data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
- data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -739
- data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -91
- data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
- data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -159
- data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
- data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -18
- data/vendor/ruby-signature/stdlib/find/find.rbs +0 -44
- data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -21
- 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 -77
- data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,64 +0,0 @@
|
|
1
|
-
require "ruby/signature/version"
|
2
|
-
|
3
|
-
require "set"
|
4
|
-
require "json"
|
5
|
-
require "pathname"
|
6
|
-
require "pp"
|
7
|
-
require "ripper"
|
8
|
-
require "logger"
|
9
|
-
require "tsort"
|
10
|
-
|
11
|
-
require "ruby/signature/errors"
|
12
|
-
require "ruby/signature/buffer"
|
13
|
-
require "ruby/signature/location"
|
14
|
-
require "ruby/signature/namespace"
|
15
|
-
require "ruby/signature/type_name"
|
16
|
-
require "ruby/signature/types"
|
17
|
-
require "ruby/signature/method_type"
|
18
|
-
require "ruby/signature/ast/declarations"
|
19
|
-
require "ruby/signature/ast/members"
|
20
|
-
require "ruby/signature/ast/annotation"
|
21
|
-
require "ruby/signature/environment"
|
22
|
-
require "ruby/signature/environment_loader"
|
23
|
-
require "ruby/signature/builtin_names"
|
24
|
-
require "ruby/signature/definition"
|
25
|
-
require "ruby/signature/definition_builder"
|
26
|
-
require "ruby/signature/variance_calculator"
|
27
|
-
require "ruby/signature/substitution"
|
28
|
-
require "ruby/signature/constant"
|
29
|
-
require "ruby/signature/constant_table"
|
30
|
-
require "ruby/signature/ast/comment"
|
31
|
-
require "ruby/signature/writer"
|
32
|
-
require "ruby/signature/prototype/rbi"
|
33
|
-
require "ruby/signature/prototype/rb"
|
34
|
-
require "ruby/signature/prototype/runtime"
|
35
|
-
require "ruby/signature/environment_walker"
|
36
|
-
require "ruby/signature/vendorer"
|
37
|
-
|
38
|
-
begin
|
39
|
-
require "ruby/signature/parser"
|
40
|
-
rescue LoadError
|
41
|
-
STDERR.puts "Missing parser Ruby code? Running `rake parser` may solve the issue"
|
42
|
-
raise
|
43
|
-
end
|
44
|
-
|
45
|
-
module Ruby::Signature
|
46
|
-
class <<self
|
47
|
-
attr_reader :logger_level
|
48
|
-
attr_reader :logger_output
|
49
|
-
|
50
|
-
def logger
|
51
|
-
@logger ||= Logger.new(logger_output || STDERR, level: logger_level || "warn", progname: "ruby-signature")
|
52
|
-
end
|
53
|
-
|
54
|
-
def logger_output=(val)
|
55
|
-
@logger_output = val
|
56
|
-
@logger = nil
|
57
|
-
end
|
58
|
-
|
59
|
-
def logger_level=(level)
|
60
|
-
@logger_level = level
|
61
|
-
@logger = nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Ruby
|
2
|
-
module Signature
|
3
|
-
module AST
|
4
|
-
class Annotation
|
5
|
-
attr_reader :string
|
6
|
-
attr_reader :location
|
7
|
-
|
8
|
-
def initialize(string:, location:)
|
9
|
-
@string = string
|
10
|
-
@location = location
|
11
|
-
end
|
12
|
-
|
13
|
-
def ==(other)
|
14
|
-
other.is_a?(Annotation) && other.string == string
|
15
|
-
end
|
16
|
-
|
17
|
-
alias eql? ==
|
18
|
-
|
19
|
-
def hash
|
20
|
-
self.class.hash ^ string.hash
|
21
|
-
end
|
22
|
-
|
23
|
-
def to_json(*a)
|
24
|
-
{ string: string, location: location }.to_json(*a)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Ruby
|
2
|
-
module Signature
|
3
|
-
module AST
|
4
|
-
class Comment
|
5
|
-
attr_reader :string
|
6
|
-
attr_reader :location
|
7
|
-
|
8
|
-
def initialize(string:, location:)
|
9
|
-
@string = string
|
10
|
-
@location = location
|
11
|
-
end
|
12
|
-
|
13
|
-
def ==(other)
|
14
|
-
other.is_a?(Comment) && other.string == string
|
15
|
-
end
|
16
|
-
|
17
|
-
alias eql? ==
|
18
|
-
|
19
|
-
def hash
|
20
|
-
self.class.hash ^ string.hash
|
21
|
-
end
|
22
|
-
|
23
|
-
def to_json(*a)
|
24
|
-
{ string: string, location: location }.to_json(*a)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,391 +0,0 @@
|
|
1
|
-
module Ruby
|
2
|
-
module Signature
|
3
|
-
module AST
|
4
|
-
module Declarations
|
5
|
-
class ModuleTypeParams
|
6
|
-
attr_reader :params
|
7
|
-
|
8
|
-
TypeParam = Struct.new(:name, :variance, :skip_validation, keyword_init: true)
|
9
|
-
|
10
|
-
def initialize()
|
11
|
-
@params = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def add(param)
|
15
|
-
params << param
|
16
|
-
self
|
17
|
-
end
|
18
|
-
|
19
|
-
def ==(other)
|
20
|
-
other.is_a?(ModuleTypeParams) && other.params == params
|
21
|
-
end
|
22
|
-
|
23
|
-
def [](name)
|
24
|
-
params.find {|p| p.name == name }
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_json(*a)
|
28
|
-
{
|
29
|
-
params: params
|
30
|
-
}.to_json(*a)
|
31
|
-
end
|
32
|
-
|
33
|
-
def each(&block)
|
34
|
-
params.each(&block)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.empty
|
38
|
-
new
|
39
|
-
end
|
40
|
-
|
41
|
-
def variance(name)
|
42
|
-
self[name].variance
|
43
|
-
end
|
44
|
-
|
45
|
-
def skip_validation?(name)
|
46
|
-
self[name].skip_validation
|
47
|
-
end
|
48
|
-
|
49
|
-
def empty?
|
50
|
-
params.empty?
|
51
|
-
end
|
52
|
-
|
53
|
-
def size
|
54
|
-
params.size
|
55
|
-
end
|
56
|
-
|
57
|
-
def rename_to(names)
|
58
|
-
ModuleTypeParams.new().tap do |params|
|
59
|
-
names.each.with_index do |new_name, index|
|
60
|
-
param = self.params[index]
|
61
|
-
params.add(TypeParam.new(name: new_name, variance: param.variance, skip_validation: param.skip_validation))
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
class Class
|
68
|
-
class Super
|
69
|
-
attr_reader :name
|
70
|
-
attr_reader :args
|
71
|
-
|
72
|
-
def initialize(name:, args:)
|
73
|
-
@name = name
|
74
|
-
@args = args
|
75
|
-
end
|
76
|
-
|
77
|
-
def ==(other)
|
78
|
-
other.is_a?(Super) && other.name == name && other.args == args
|
79
|
-
end
|
80
|
-
|
81
|
-
alias eql? ==
|
82
|
-
|
83
|
-
def hash
|
84
|
-
self.class.hash ^ name.hash ^ args.hash
|
85
|
-
end
|
86
|
-
|
87
|
-
def to_json(*a)
|
88
|
-
{
|
89
|
-
name: name,
|
90
|
-
args: args
|
91
|
-
}.to_json(*a)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
attr_reader :name
|
96
|
-
attr_reader :type_params
|
97
|
-
attr_reader :members
|
98
|
-
attr_reader :super_class
|
99
|
-
attr_reader :annotations
|
100
|
-
attr_reader :location
|
101
|
-
attr_reader :comment
|
102
|
-
|
103
|
-
def initialize(name:, type_params:, super_class:, members:, annotations:, location:, comment:)
|
104
|
-
@name = name
|
105
|
-
@type_params = type_params
|
106
|
-
@super_class = super_class
|
107
|
-
@members = members
|
108
|
-
@annotations = annotations
|
109
|
-
@location = location
|
110
|
-
@comment = comment
|
111
|
-
end
|
112
|
-
|
113
|
-
def ==(other)
|
114
|
-
other.is_a?(Class) &&
|
115
|
-
other.name == name &&
|
116
|
-
other.type_params == type_params &&
|
117
|
-
other.super_class == super_class &&
|
118
|
-
other.members == members
|
119
|
-
end
|
120
|
-
|
121
|
-
alias eql? ==
|
122
|
-
|
123
|
-
def hash
|
124
|
-
self.class.hash ^ name.hash ^ type_params.hash ^ super_class.hash ^ members.hash
|
125
|
-
end
|
126
|
-
|
127
|
-
def to_json(*a)
|
128
|
-
{
|
129
|
-
declaration: :class,
|
130
|
-
name: name,
|
131
|
-
type_params: type_params,
|
132
|
-
members: members,
|
133
|
-
super_class: super_class,
|
134
|
-
annotations: annotations,
|
135
|
-
location: location,
|
136
|
-
comment: comment
|
137
|
-
}.to_json(*a)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
class Module
|
142
|
-
attr_reader :name
|
143
|
-
attr_reader :type_params
|
144
|
-
attr_reader :members
|
145
|
-
attr_reader :location
|
146
|
-
attr_reader :annotations
|
147
|
-
attr_reader :self_type
|
148
|
-
attr_reader :comment
|
149
|
-
|
150
|
-
def initialize(name:, type_params:, members:, self_type:, annotations:, location:, comment:)
|
151
|
-
@name = name
|
152
|
-
@type_params = type_params
|
153
|
-
@self_type = self_type
|
154
|
-
@members = members
|
155
|
-
@annotations = annotations
|
156
|
-
@location = location
|
157
|
-
@comment = comment
|
158
|
-
end
|
159
|
-
|
160
|
-
def ==(other)
|
161
|
-
other.is_a?(Module) &&
|
162
|
-
other.name == name &&
|
163
|
-
other.type_params == type_params &&
|
164
|
-
other.self_type == self_type &&
|
165
|
-
other.members == members
|
166
|
-
end
|
167
|
-
|
168
|
-
alias eql? ==
|
169
|
-
|
170
|
-
def hash
|
171
|
-
self.class.hash ^ name.hash ^ type_params.hash ^ self_type.hash ^ members.hash
|
172
|
-
end
|
173
|
-
|
174
|
-
def to_json(*a)
|
175
|
-
{
|
176
|
-
declaration: :module,
|
177
|
-
name: name,
|
178
|
-
type_params: type_params,
|
179
|
-
members: members,
|
180
|
-
self_type: self_type,
|
181
|
-
annotations: annotations,
|
182
|
-
location: location,
|
183
|
-
comment: comment
|
184
|
-
}.to_json(*a)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
class Extension
|
189
|
-
attr_reader :name
|
190
|
-
attr_reader :type_params
|
191
|
-
attr_reader :extension_name
|
192
|
-
attr_reader :members
|
193
|
-
attr_reader :annotations
|
194
|
-
attr_reader :location
|
195
|
-
attr_reader :comment
|
196
|
-
|
197
|
-
def initialize(name:, type_params:, extension_name:, members:, annotations:, location:, comment:)
|
198
|
-
@name = name
|
199
|
-
@type_params = type_params
|
200
|
-
@extension_name = extension_name
|
201
|
-
@members = members
|
202
|
-
@annotations = annotations
|
203
|
-
@location = location
|
204
|
-
@comment = comment
|
205
|
-
end
|
206
|
-
|
207
|
-
def ==(other)
|
208
|
-
other.is_a?(Extension) &&
|
209
|
-
other.name == name &&
|
210
|
-
other.type_params == type_params &&
|
211
|
-
other.extension_name == extension_name &&
|
212
|
-
other.members == members
|
213
|
-
end
|
214
|
-
|
215
|
-
alias eql? ==
|
216
|
-
|
217
|
-
def hash
|
218
|
-
self.class.hash ^ name.hash ^ type_params.hash ^ extension_name.hash ^ members.hash
|
219
|
-
end
|
220
|
-
|
221
|
-
def to_json(*a)
|
222
|
-
{
|
223
|
-
declaration: :extension,
|
224
|
-
name: name,
|
225
|
-
type_params: type_params,
|
226
|
-
extension_name: extension_name,
|
227
|
-
members: members,
|
228
|
-
annotations: annotations,
|
229
|
-
location: location,
|
230
|
-
comment: comment
|
231
|
-
}.to_json(*a)
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
class Interface
|
236
|
-
attr_reader :name
|
237
|
-
attr_reader :type_params
|
238
|
-
attr_reader :members
|
239
|
-
attr_reader :annotations
|
240
|
-
attr_reader :location
|
241
|
-
attr_reader :comment
|
242
|
-
|
243
|
-
def initialize(name:, type_params:, members:, annotations:, location:, comment:)
|
244
|
-
@name = name
|
245
|
-
@type_params = type_params
|
246
|
-
@members = members
|
247
|
-
@annotations = annotations
|
248
|
-
@location = location
|
249
|
-
@comment = comment
|
250
|
-
end
|
251
|
-
|
252
|
-
def ==(other)
|
253
|
-
other.is_a?(Interface) &&
|
254
|
-
other.name == name &&
|
255
|
-
other.type_params == type_params &&
|
256
|
-
other.members == members
|
257
|
-
end
|
258
|
-
|
259
|
-
alias eql? ==
|
260
|
-
|
261
|
-
def hash
|
262
|
-
self.class.hash ^ type_params.hash ^ members.hash
|
263
|
-
end
|
264
|
-
|
265
|
-
def to_json(*a)
|
266
|
-
{
|
267
|
-
declaration: :interface,
|
268
|
-
name: name,
|
269
|
-
type_params: type_params,
|
270
|
-
members: members,
|
271
|
-
annotations: annotations,
|
272
|
-
location: location,
|
273
|
-
comment: comment
|
274
|
-
}.to_json(*a)
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
class Alias
|
279
|
-
attr_reader :name
|
280
|
-
attr_reader :type
|
281
|
-
attr_reader :annotations
|
282
|
-
attr_reader :location
|
283
|
-
attr_reader :comment
|
284
|
-
|
285
|
-
def initialize(name:, type:, annotations:, location:, comment:)
|
286
|
-
@name = name
|
287
|
-
@type = type
|
288
|
-
@annotations = annotations
|
289
|
-
@location = location
|
290
|
-
@comment = comment
|
291
|
-
end
|
292
|
-
|
293
|
-
def ==(other)
|
294
|
-
other.is_a?(Alias) &&
|
295
|
-
other.name == name &&
|
296
|
-
other.type == type
|
297
|
-
end
|
298
|
-
|
299
|
-
alias eql? ==
|
300
|
-
|
301
|
-
def hash
|
302
|
-
self.class.hash ^ name.hash ^ type.hash
|
303
|
-
end
|
304
|
-
|
305
|
-
def to_json(*a)
|
306
|
-
{
|
307
|
-
declaration: :alias,
|
308
|
-
name: name,
|
309
|
-
type: type,
|
310
|
-
annotations: annotations,
|
311
|
-
location: location,
|
312
|
-
comment: comment
|
313
|
-
}.to_json(*a)
|
314
|
-
end
|
315
|
-
end
|
316
|
-
|
317
|
-
class Constant
|
318
|
-
attr_reader :name
|
319
|
-
attr_reader :type
|
320
|
-
attr_reader :location
|
321
|
-
attr_reader :comment
|
322
|
-
|
323
|
-
def initialize(name:, type:, location:, comment:)
|
324
|
-
@name = name
|
325
|
-
@type = type
|
326
|
-
@location = location
|
327
|
-
@comment = comment
|
328
|
-
end
|
329
|
-
|
330
|
-
def ==(other)
|
331
|
-
other.is_a?(Constant) &&
|
332
|
-
other.name == name &&
|
333
|
-
other.type == type
|
334
|
-
end
|
335
|
-
|
336
|
-
alias eql? ==
|
337
|
-
|
338
|
-
def hash
|
339
|
-
self.class.hash ^ name.hash ^ type.hash
|
340
|
-
end
|
341
|
-
|
342
|
-
def to_json(*a)
|
343
|
-
{
|
344
|
-
declaration: :constant,
|
345
|
-
name: name,
|
346
|
-
type: type,
|
347
|
-
location: location,
|
348
|
-
comment: comment
|
349
|
-
}.to_json(*a)
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
class Global
|
354
|
-
attr_reader :name
|
355
|
-
attr_reader :type
|
356
|
-
attr_reader :location
|
357
|
-
attr_reader :comment
|
358
|
-
|
359
|
-
def initialize(name:, type:, location:, comment:)
|
360
|
-
@name = name
|
361
|
-
@type = type
|
362
|
-
@location = location
|
363
|
-
@comment = comment
|
364
|
-
end
|
365
|
-
|
366
|
-
def ==(other)
|
367
|
-
other.is_a?(Global) &&
|
368
|
-
other.name == name &&
|
369
|
-
other.type == type
|
370
|
-
end
|
371
|
-
|
372
|
-
alias eql? ==
|
373
|
-
|
374
|
-
def hash
|
375
|
-
self.class.hash ^ name.hash ^ type.hash
|
376
|
-
end
|
377
|
-
|
378
|
-
def to_json(*a)
|
379
|
-
{
|
380
|
-
declaration: :global,
|
381
|
-
name: name,
|
382
|
-
type: type,
|
383
|
-
location: location,
|
384
|
-
comment: comment
|
385
|
-
}.to_json(*a)
|
386
|
-
end
|
387
|
-
end
|
388
|
-
end
|
389
|
-
end
|
390
|
-
end
|
391
|
-
end
|