steep 0.13.0 → 0.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +28 -0
  4. data/Rakefile +0 -13
  5. data/bin/setup +0 -2
  6. data/bin/smoke_runner.rb +0 -1
  7. data/exe/steep +0 -1
  8. data/lib/steep.rb +33 -1
  9. data/lib/steep/annotation_parser.rb +4 -4
  10. data/lib/steep/ast/buffer.rb +11 -7
  11. data/lib/steep/ast/builtin.rb +8 -0
  12. data/lib/steep/ast/types/factory.rb +124 -89
  13. data/lib/steep/cli.rb +16 -1
  14. data/lib/steep/drivers/annotations.rb +1 -1
  15. data/lib/steep/drivers/check.rb +20 -4
  16. data/lib/steep/drivers/init.rb +5 -5
  17. data/lib/steep/drivers/langserver.rb +13 -287
  18. data/lib/steep/drivers/utils/driver_helper.rb +1 -1
  19. data/lib/steep/drivers/vendor.rb +2 -2
  20. data/lib/steep/drivers/watch.rb +97 -85
  21. data/lib/steep/drivers/worker.rb +51 -0
  22. data/lib/steep/project.rb +9 -5
  23. data/lib/steep/project/completion_provider.rb +298 -0
  24. data/lib/steep/project/dsl.rb +14 -0
  25. data/lib/steep/project/file.rb +54 -47
  26. data/lib/steep/project/hover_content.rb +17 -8
  27. data/lib/steep/project/options.rb +25 -3
  28. data/lib/steep/project/target.rb +40 -24
  29. data/lib/steep/server/base_worker.rb +56 -0
  30. data/lib/steep/server/code_worker.rb +151 -0
  31. data/lib/steep/server/interaction_worker.rb +281 -0
  32. data/lib/steep/server/master.rb +196 -0
  33. data/lib/steep/server/signature_worker.rb +148 -0
  34. data/lib/steep/server/utils.rb +36 -0
  35. data/lib/steep/server/worker_process.rb +62 -0
  36. data/lib/steep/signature/errors.rb +1 -1
  37. data/lib/steep/signature/validator.rb +13 -13
  38. data/lib/steep/source.rb +1 -1
  39. data/lib/steep/type_construction.rb +1004 -727
  40. data/lib/steep/type_inference/constant_env.rb +3 -11
  41. data/lib/steep/type_inference/context.rb +8 -3
  42. data/lib/steep/type_inference/context_array.rb +111 -0
  43. data/lib/steep/type_inference/local_variable_type_env.rb +226 -0
  44. data/lib/steep/type_inference/logic.rb +130 -0
  45. data/lib/steep/type_inference/type_env.rb +5 -69
  46. data/lib/steep/typing.rb +91 -23
  47. data/lib/steep/version.rb +1 -1
  48. data/smoke/alias/Steepfile +1 -0
  49. data/smoke/alias/a.rb +1 -1
  50. data/smoke/and/Steepfile +1 -0
  51. data/smoke/array/Steepfile +1 -0
  52. data/smoke/array/b.rb +0 -2
  53. data/smoke/block/Steepfile +1 -0
  54. data/smoke/case/Steepfile +1 -0
  55. data/smoke/class/Steepfile +1 -0
  56. data/smoke/const/Steepfile +1 -0
  57. data/smoke/dstr/Steepfile +1 -0
  58. data/smoke/ensure/Steepfile +1 -0
  59. data/smoke/enumerator/Steepfile +1 -0
  60. data/smoke/extension/Steepfile +1 -0
  61. data/smoke/extension/c.rb +1 -0
  62. data/smoke/hash/Steepfile +1 -0
  63. data/smoke/hello/Steepfile +1 -0
  64. data/smoke/if/Steepfile +1 -0
  65. data/smoke/if/a.rb +1 -1
  66. data/smoke/implements/Steepfile +1 -0
  67. data/smoke/initialize/Steepfile +1 -0
  68. data/smoke/integer/Steepfile +1 -0
  69. data/smoke/interface/Steepfile +1 -0
  70. data/smoke/kwbegin/Steepfile +1 -0
  71. data/smoke/lambda/Steepfile +1 -0
  72. data/smoke/literal/Steepfile +1 -0
  73. data/smoke/map/Steepfile +1 -0
  74. data/smoke/method/Steepfile +1 -0
  75. data/smoke/module/Steepfile +1 -0
  76. data/smoke/regexp/Steepfile +1 -0
  77. data/smoke/regexp/b.rb +4 -4
  78. data/smoke/regression/Steepfile +1 -0
  79. data/smoke/rescue/Steepfile +1 -0
  80. data/smoke/rescue/a.rb +1 -1
  81. data/smoke/self/Steepfile +1 -0
  82. data/smoke/skip/Steepfile +1 -0
  83. data/smoke/stdout/Steepfile +1 -0
  84. data/smoke/super/Steepfile +1 -0
  85. data/smoke/type_case/Steepfile +1 -0
  86. data/smoke/yield/Steepfile +1 -0
  87. data/steep.gemspec +8 -8
  88. metadata +38 -138
  89. data/exe/rbs +0 -3
  90. data/exe/ruby-signature +0 -3
  91. data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
  92. data/vendor/ruby-signature/.gitignore +0 -12
  93. data/vendor/ruby-signature/.rubocop.yml +0 -15
  94. data/vendor/ruby-signature/BSDL +0 -22
  95. data/vendor/ruby-signature/COPYING +0 -56
  96. data/vendor/ruby-signature/Gemfile +0 -6
  97. data/vendor/ruby-signature/README.md +0 -93
  98. data/vendor/ruby-signature/Rakefile +0 -66
  99. data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -156
  100. data/vendor/ruby-signature/bin/console +0 -14
  101. data/vendor/ruby-signature/bin/query-rdoc +0 -103
  102. data/vendor/ruby-signature/bin/setup +0 -10
  103. data/vendor/ruby-signature/bin/sort +0 -88
  104. data/vendor/ruby-signature/bin/test_runner.rb +0 -17
  105. data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
  106. data/vendor/ruby-signature/docs/sigs.md +0 -148
  107. data/vendor/ruby-signature/docs/stdlib.md +0 -152
  108. data/vendor/ruby-signature/docs/syntax.md +0 -528
  109. data/vendor/ruby-signature/exe/rbs +0 -3
  110. data/vendor/ruby-signature/exe/ruby-signature +0 -7
  111. data/vendor/ruby-signature/lib/ruby/signature.rb +0 -64
  112. data/vendor/ruby-signature/lib/ruby/signature/ast/annotation.rb +0 -29
  113. data/vendor/ruby-signature/lib/ruby/signature/ast/comment.rb +0 -29
  114. data/vendor/ruby-signature/lib/ruby/signature/ast/declarations.rb +0 -391
  115. data/vendor/ruby-signature/lib/ruby/signature/ast/members.rb +0 -364
  116. data/vendor/ruby-signature/lib/ruby/signature/buffer.rb +0 -52
  117. data/vendor/ruby-signature/lib/ruby/signature/builtin_names.rb +0 -54
  118. data/vendor/ruby-signature/lib/ruby/signature/cli.rb +0 -534
  119. data/vendor/ruby-signature/lib/ruby/signature/constant.rb +0 -28
  120. data/vendor/ruby-signature/lib/ruby/signature/constant_table.rb +0 -152
  121. data/vendor/ruby-signature/lib/ruby/signature/definition.rb +0 -172
  122. data/vendor/ruby-signature/lib/ruby/signature/definition_builder.rb +0 -921
  123. data/vendor/ruby-signature/lib/ruby/signature/environment.rb +0 -283
  124. data/vendor/ruby-signature/lib/ruby/signature/environment_loader.rb +0 -138
  125. data/vendor/ruby-signature/lib/ruby/signature/environment_walker.rb +0 -126
  126. data/vendor/ruby-signature/lib/ruby/signature/errors.rb +0 -189
  127. data/vendor/ruby-signature/lib/ruby/signature/location.rb +0 -104
  128. data/vendor/ruby-signature/lib/ruby/signature/method_type.rb +0 -125
  129. data/vendor/ruby-signature/lib/ruby/signature/namespace.rb +0 -93
  130. data/vendor/ruby-signature/lib/ruby/signature/parser.y +0 -1343
  131. data/vendor/ruby-signature/lib/ruby/signature/prototype/rb.rb +0 -441
  132. data/vendor/ruby-signature/lib/ruby/signature/prototype/rbi.rb +0 -579
  133. data/vendor/ruby-signature/lib/ruby/signature/prototype/runtime.rb +0 -383
  134. data/vendor/ruby-signature/lib/ruby/signature/substitution.rb +0 -48
  135. data/vendor/ruby-signature/lib/ruby/signature/test.rb +0 -28
  136. data/vendor/ruby-signature/lib/ruby/signature/test/errors.rb +0 -63
  137. data/vendor/ruby-signature/lib/ruby/signature/test/hook.rb +0 -290
  138. data/vendor/ruby-signature/lib/ruby/signature/test/setup.rb +0 -58
  139. data/vendor/ruby-signature/lib/ruby/signature/test/spy.rb +0 -324
  140. data/vendor/ruby-signature/lib/ruby/signature/test/test_helper.rb +0 -185
  141. data/vendor/ruby-signature/lib/ruby/signature/test/type_check.rb +0 -256
  142. data/vendor/ruby-signature/lib/ruby/signature/type_name.rb +0 -72
  143. data/vendor/ruby-signature/lib/ruby/signature/types.rb +0 -932
  144. data/vendor/ruby-signature/lib/ruby/signature/variance_calculator.rb +0 -140
  145. data/vendor/ruby-signature/lib/ruby/signature/vendorer.rb +0 -49
  146. data/vendor/ruby-signature/lib/ruby/signature/version.rb +0 -5
  147. data/vendor/ruby-signature/lib/ruby/signature/writer.rb +0 -271
  148. data/vendor/ruby-signature/ruby-signature.gemspec +0 -45
  149. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -3
  150. data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -15
  151. data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
  152. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
  153. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
  154. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -35
  155. data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
  156. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
  157. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
  158. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
  159. data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
  160. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
  161. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -419
  162. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -606
  163. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
  164. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
  165. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
  166. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
  167. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -193
  168. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
  169. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
  170. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
  171. data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -476
  172. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
  173. data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
  174. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -121
  175. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
  176. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -710
  177. data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
  178. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -574
  179. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -135
  180. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -141
  181. data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -66
  182. data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -182
  183. data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -248
  184. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
  185. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
  186. data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
  187. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -426
  188. data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -354
  189. data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -93
  190. data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
  191. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
  192. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -10
  193. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -131
  194. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
  195. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
  196. data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -770
  197. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -13
  198. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
  199. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -230
  200. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1112
  201. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
  202. data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -739
  203. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -91
  204. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
  205. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -159
  206. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
  207. data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -18
  208. data/vendor/ruby-signature/stdlib/find/find.rbs +0 -44
  209. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -21
  210. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
  211. data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
  212. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
  213. data/vendor/ruby-signature/stdlib/set/set.rbs +0 -77
  214. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- load File.join(__dir__, "ruby-signature")
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $LOAD_PATH << File.join(__dir__, "../lib")
4
- require "ruby/signature"
5
- require "ruby/signature/cli"
6
-
7
- Ruby::Signature::CLI.new(stdout: STDOUT, stderr: STDERR).run(ARGV.dup)
@@ -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