rbs 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/Rakefile +2 -0
- data/core/array.rbs +1 -1
- data/core/enumerable.rbs +1 -1
- data/core/hash.rbs +13 -5
- data/core/io.rbs +3 -3
- data/core/module.rbs +1 -1
- data/core/numeric.rbs +10 -0
- data/core/proc.rbs +1 -1
- data/core/random.rbs +4 -2
- data/core/range.rbs +2 -2
- data/core/struct.rbs +3 -2
- data/core/thread.rbs +1 -1
- data/docs/CONTRIBUTING.md +5 -3
- data/docs/sigs.md +18 -1
- data/docs/syntax.md +11 -11
- data/lib/rbs.rb +1 -0
- data/lib/rbs/ast/annotation.rb +2 -2
- data/lib/rbs/ast/comment.rb +2 -2
- data/lib/rbs/ast/declarations.rb +37 -22
- data/lib/rbs/ast/members.rb +26 -26
- data/lib/rbs/cli.rb +3 -0
- data/lib/rbs/constant_table.rb +4 -1
- data/lib/rbs/definition.rb +1 -1
- data/lib/rbs/definition_builder.rb +14 -0
- data/lib/rbs/definition_builder/ancestor_builder.rb +1 -0
- data/lib/rbs/definition_builder/method_builder.rb +4 -2
- data/lib/rbs/location.rb +106 -2
- data/lib/rbs/locator.rb +205 -0
- data/lib/rbs/method_type.rb +2 -2
- data/lib/rbs/parser.rb +1050 -713
- data/lib/rbs/parser.y +403 -71
- data/lib/rbs/test/hook.rb +8 -2
- data/lib/rbs/type_name.rb +2 -3
- data/lib/rbs/type_name_resolver.rb +1 -1
- data/lib/rbs/types.rb +36 -34
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +4 -2
- data/sig/annotation.rbs +1 -1
- data/sig/cli.rbs +31 -21
- data/sig/comment.rbs +1 -1
- data/sig/declarations.rbs +106 -21
- data/sig/environment.rbs +2 -2
- data/sig/location.rbs +84 -3
- data/sig/locator.rbs +44 -0
- data/sig/members.rbs +76 -12
- data/sig/method_builder.rbs +1 -1
- data/sig/method_types.rbs +1 -1
- data/sig/polyfill.rbs +13 -8
- data/sig/rbs.rbs +8 -4
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +60 -19
- data/sig/util.rbs +0 -4
- data/sig/writer.rbs +8 -2
- data/stdlib/rubygems/0/requirement.rbs +84 -2
- data/stdlib/rubygems/0/version.rbs +2 -1
- data/stdlib/shellwords/0/shellwords.rbs +252 -0
- data/steep/Gemfile.lock +16 -13
- metadata +5 -2
data/lib/rbs/test/hook.rb
CHANGED
@@ -25,7 +25,11 @@ module RBS
|
|
25
25
|
:! => "not",
|
26
26
|
:<< => "lshift",
|
27
27
|
:>> => "rshift",
|
28
|
-
:~ => "tilda"
|
28
|
+
:~ => "tilda",
|
29
|
+
:=~ => "eqtilda",
|
30
|
+
:% => "percent",
|
31
|
+
:+@ => "unary_plus",
|
32
|
+
:-@ => "unary_minus"
|
29
33
|
}
|
30
34
|
def self.alias_names(target, random)
|
31
35
|
suffix = "#{RBS::Test.suffix}_#{random}"
|
@@ -71,7 +75,9 @@ module RBS
|
|
71
75
|
with_name, without_name = alias_names(method_name, random)
|
72
76
|
full_method_name = "#{prefix}#{method_name}"
|
73
77
|
|
74
|
-
param_source = params.take_while {|param| param[0] == :req }
|
78
|
+
param_source = params.take_while {|param| param[0] == :req }
|
79
|
+
.map.with_index {|pair, index| pair[1] || "__req__#{random}__#{index}" }
|
80
|
+
param_source.push("*rest_args__#{random}")
|
75
81
|
block_param = "block__#{random}"
|
76
82
|
|
77
83
|
RBS.logger.debug {
|
data/lib/rbs/type_name.rb
CHANGED
data/lib/rbs/types.rb
CHANGED
@@ -52,9 +52,9 @@ module RBS
|
|
52
52
|
include EmptyEachType
|
53
53
|
include NoTypeName
|
54
54
|
|
55
|
-
def to_json(
|
55
|
+
def to_json(state = _ = nil)
|
56
56
|
klass = to_s.to_sym
|
57
|
-
{ class: klass, location: location }.to_json(
|
57
|
+
{ class: klass, location: location }.to_json(state)
|
58
58
|
end
|
59
59
|
|
60
60
|
def to_s(level = 0)
|
@@ -125,8 +125,8 @@ module RBS
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
def to_json(
|
129
|
-
{ class: :variable, name: name, location: location }.to_json(
|
128
|
+
def to_json(state = _ = nil)
|
129
|
+
{ class: :variable, name: name, location: location }.to_json(state)
|
130
130
|
end
|
131
131
|
|
132
132
|
def sub(s)
|
@@ -177,8 +177,8 @@ module RBS
|
|
177
177
|
include NoFreeVariables
|
178
178
|
include NoSubst
|
179
179
|
|
180
|
-
def to_json(
|
181
|
-
{ class: :class_singleton, name: name, location: location }.to_json(
|
180
|
+
def to_json(state = _ = nil)
|
181
|
+
{ class: :class_singleton, name: name, location: location }.to_json(state)
|
182
182
|
end
|
183
183
|
|
184
184
|
def to_s(level = 0)
|
@@ -245,8 +245,8 @@ module RBS
|
|
245
245
|
@location = location
|
246
246
|
end
|
247
247
|
|
248
|
-
def to_json(
|
249
|
-
{ class: :interface, name: name, args: args, location: location }.to_json(
|
248
|
+
def to_json(state = _ = nil)
|
249
|
+
{ class: :interface, name: name, args: args, location: location }.to_json(state)
|
250
250
|
end
|
251
251
|
|
252
252
|
def sub(s)
|
@@ -275,8 +275,8 @@ module RBS
|
|
275
275
|
@location = location
|
276
276
|
end
|
277
277
|
|
278
|
-
def to_json(
|
279
|
-
{ class: :class_instance, name: name, args: args, location: location }.to_json(
|
278
|
+
def to_json(state = _ = nil)
|
279
|
+
{ class: :class_instance, name: name, args: args, location: location }.to_json(state)
|
280
280
|
end
|
281
281
|
|
282
282
|
def sub(s)
|
@@ -316,8 +316,8 @@ module RBS
|
|
316
316
|
include NoFreeVariables
|
317
317
|
include NoSubst
|
318
318
|
|
319
|
-
def to_json(
|
320
|
-
{ class: :alias, name: name, location: location }.to_json(
|
319
|
+
def to_json(state = _ = nil)
|
320
|
+
{ class: :alias, name: name, location: location }.to_json(state)
|
321
321
|
end
|
322
322
|
|
323
323
|
def to_s(level = 0)
|
@@ -361,8 +361,8 @@ module RBS
|
|
361
361
|
end
|
362
362
|
end
|
363
363
|
|
364
|
-
def to_json(
|
365
|
-
{ class: :tuple, types: types, location: location }.to_json(
|
364
|
+
def to_json(state = _ = nil)
|
365
|
+
{ class: :tuple, types: types, location: location }.to_json(state)
|
366
366
|
end
|
367
367
|
|
368
368
|
def sub(s)
|
@@ -421,8 +421,8 @@ module RBS
|
|
421
421
|
end
|
422
422
|
end
|
423
423
|
|
424
|
-
def to_json(
|
425
|
-
{ class: :record, fields: fields, location: location }.to_json(
|
424
|
+
def to_json(state = _ = nil)
|
425
|
+
{ class: :record, fields: fields, location: location }.to_json(state)
|
426
426
|
end
|
427
427
|
|
428
428
|
def sub(s)
|
@@ -482,8 +482,8 @@ module RBS
|
|
482
482
|
type.free_variables(set)
|
483
483
|
end
|
484
484
|
|
485
|
-
def to_json(
|
486
|
-
{ class: :optional, type: type, location: location }.to_json(
|
485
|
+
def to_json(state = _ = nil)
|
486
|
+
{ class: :optional, type: type, location: location }.to_json(state)
|
487
487
|
end
|
488
488
|
|
489
489
|
def sub(s)
|
@@ -545,8 +545,8 @@ module RBS
|
|
545
545
|
end
|
546
546
|
end
|
547
547
|
|
548
|
-
def to_json(
|
549
|
-
{ class: :union, types: types, location: location }.to_json(
|
548
|
+
def to_json(state = _ = nil)
|
549
|
+
{ class: :union, types: types, location: location }.to_json(state)
|
550
550
|
end
|
551
551
|
|
552
552
|
def sub(s)
|
@@ -613,8 +613,8 @@ module RBS
|
|
613
613
|
end
|
614
614
|
end
|
615
615
|
|
616
|
-
def to_json(
|
617
|
-
{ class: :intersection, types: types, location: location }.to_json(
|
616
|
+
def to_json(state = _ = nil)
|
617
|
+
{ class: :intersection, types: types, location: location }.to_json(state)
|
618
618
|
end
|
619
619
|
|
620
620
|
def sub(s)
|
@@ -659,10 +659,12 @@ module RBS
|
|
659
659
|
class Param
|
660
660
|
attr_reader :type
|
661
661
|
attr_reader :name
|
662
|
+
attr_reader :location
|
662
663
|
|
663
|
-
def initialize(type:, name:)
|
664
|
+
def initialize(type:, name:, location: nil)
|
664
665
|
@type = type
|
665
666
|
@name = name
|
667
|
+
@location = location
|
666
668
|
end
|
667
669
|
|
668
670
|
def ==(other)
|
@@ -677,14 +679,14 @@ module RBS
|
|
677
679
|
|
678
680
|
def map_type(&block)
|
679
681
|
if block
|
680
|
-
Param.new(name: name, type: yield(type))
|
682
|
+
Param.new(name: name, type: yield(type), location: location)
|
681
683
|
else
|
682
684
|
enum_for :map_type
|
683
685
|
end
|
684
686
|
end
|
685
687
|
|
686
|
-
def to_json(
|
687
|
-
{ type: type, name: name }.to_json(
|
688
|
+
def to_json(state = _ = nil)
|
689
|
+
{ type: type, name: name }.to_json(state)
|
688
690
|
end
|
689
691
|
|
690
692
|
def to_s
|
@@ -826,7 +828,7 @@ module RBS
|
|
826
828
|
end
|
827
829
|
end
|
828
830
|
|
829
|
-
def to_json(
|
831
|
+
def to_json(state = _ = nil)
|
830
832
|
{
|
831
833
|
required_positionals: required_positionals,
|
832
834
|
optional_positionals: optional_positionals,
|
@@ -836,7 +838,7 @@ module RBS
|
|
836
838
|
optional_keywords: optional_keywords,
|
837
839
|
rest_keywords: rest_keywords,
|
838
840
|
return_type: return_type
|
839
|
-
}.to_json(
|
841
|
+
}.to_json(state)
|
840
842
|
end
|
841
843
|
|
842
844
|
def sub(s)
|
@@ -966,11 +968,11 @@ module RBS
|
|
966
968
|
other.required == required
|
967
969
|
end
|
968
970
|
|
969
|
-
def to_json(
|
971
|
+
def to_json(state = _ = nil)
|
970
972
|
{
|
971
973
|
type: type,
|
972
974
|
required: required
|
973
|
-
}.to_json(
|
975
|
+
}.to_json(state)
|
974
976
|
end
|
975
977
|
|
976
978
|
def sub(s)
|
@@ -1015,13 +1017,13 @@ module RBS
|
|
1015
1017
|
set
|
1016
1018
|
end
|
1017
1019
|
|
1018
|
-
def to_json(
|
1020
|
+
def to_json(state = _ = nil)
|
1019
1021
|
{
|
1020
1022
|
class: :proc,
|
1021
1023
|
type: type,
|
1022
1024
|
block: block,
|
1023
1025
|
location: location
|
1024
|
-
}.to_json(
|
1026
|
+
}.to_json(state)
|
1025
1027
|
end
|
1026
1028
|
|
1027
1029
|
def sub(s)
|
@@ -1083,8 +1085,8 @@ module RBS
|
|
1083
1085
|
include EmptyEachType
|
1084
1086
|
include NoTypeName
|
1085
1087
|
|
1086
|
-
def to_json(
|
1087
|
-
{ class: :literal, literal: literal.inspect, location: location }.to_json(
|
1088
|
+
def to_json(state = _ = nil)
|
1089
|
+
{ class: :literal, literal: literal.inspect, location: location }.to_json(state)
|
1088
1090
|
end
|
1089
1091
|
|
1090
1092
|
def to_s(level = 0)
|
data/lib/rbs/version.rb
CHANGED
data/lib/rbs/writer.rb
CHANGED
data/sig/annotation.rbs
CHANGED
data/sig/cli.rbs
CHANGED
@@ -8,51 +8,61 @@ module RBS
|
|
8
8
|
attr_reader repos: Array[String]
|
9
9
|
|
10
10
|
def initialize: () -> void
|
11
|
-
|
11
|
+
|
12
12
|
def loader: () -> EnvironmentLoader
|
13
|
+
|
14
|
+
def setup_library_options: (OptionParser) -> OptionParser
|
15
|
+
end
|
16
|
+
|
17
|
+
interface _IO
|
18
|
+
def puts: (*untyped) -> void
|
19
|
+
|
20
|
+
def print: (*untyped) -> void
|
21
|
+
|
22
|
+
def flush: () -> void
|
13
23
|
end
|
14
24
|
|
15
|
-
attr_reader stdout:
|
16
|
-
attr_reader stderr:
|
25
|
+
attr_reader stdout: _IO
|
26
|
+
attr_reader stderr: _IO
|
17
27
|
|
18
28
|
def initialize: (stdout: IO, stderr: IO) -> void
|
19
|
-
|
29
|
+
|
20
30
|
COMMANDS: Array[Symbol]
|
21
31
|
|
22
32
|
def library_parse: (OptionParser, options: LibraryOptions) -> void
|
23
|
-
|
33
|
+
|
24
34
|
def parse_logging_options: (OptionParser) -> void
|
25
|
-
|
35
|
+
|
26
36
|
def has_parser?: () -> bool
|
27
|
-
|
37
|
+
|
28
38
|
def run: (Array[String] args) -> void
|
29
|
-
|
39
|
+
|
30
40
|
def run_ast: (Array[String], LibraryOptions) -> void
|
31
|
-
|
41
|
+
|
32
42
|
def run_list: (Array[String], LibraryOptions) -> void
|
33
|
-
|
43
|
+
|
34
44
|
def run_ancestors: (Array[String], LibraryOptions) -> void
|
35
|
-
|
45
|
+
|
36
46
|
def run_methods: (Array[String], LibraryOptions) -> void
|
37
|
-
|
47
|
+
|
38
48
|
def run_method: (Array[String], LibraryOptions) -> void
|
39
|
-
|
49
|
+
|
40
50
|
def run_validate: (Array[String], LibraryOptions) -> void
|
41
|
-
|
51
|
+
|
42
52
|
def run_constant: (Array[String], LibraryOptions) -> void
|
43
|
-
|
53
|
+
|
44
54
|
def run_paths: (Array[String], LibraryOptions) -> void
|
45
|
-
|
55
|
+
|
46
56
|
def run_prototype: (Array[String], LibraryOptions) -> void
|
47
|
-
|
57
|
+
|
48
58
|
def run_prototype_file: (String format, Array[String]) -> void
|
49
|
-
|
59
|
+
|
50
60
|
def run_vendor: (Array[String], LibraryOptions) -> void
|
51
|
-
|
61
|
+
|
52
62
|
def run_parse: (Array[String], LibraryOptions) -> void
|
53
|
-
|
63
|
+
|
54
64
|
def run_test: (Array[String], LibraryOptions) -> void
|
55
|
-
|
65
|
+
|
56
66
|
def test_opt: (LibraryOptions) -> String?
|
57
67
|
end
|
58
68
|
end
|
data/sig/comment.rbs
CHANGED
data/sig/declarations.rbs
CHANGED
@@ -10,11 +10,21 @@ module RBS
|
|
10
10
|
|
11
11
|
class ModuleTypeParams
|
12
12
|
class TypeParam
|
13
|
+
# Key
|
14
|
+
# ^^^ name
|
15
|
+
#
|
16
|
+
# unchecked out Elem
|
17
|
+
# ^^^^^^^^^ unchecked
|
18
|
+
# ^^^ variance
|
19
|
+
# ^^^^ name
|
20
|
+
type loc = Location::WithChildren[:name, :variance | :unchecked]
|
21
|
+
|
13
22
|
attr_reader name: Symbol
|
14
23
|
attr_reader variance: variance
|
15
24
|
attr_reader skip_validation: bool
|
25
|
+
attr_reader location: loc?
|
16
26
|
|
17
|
-
def initialize: (name: Symbol, variance: variance, skip_validation: boolish) -> void
|
27
|
+
def initialize: (name: Symbol, variance: variance, skip_validation: boolish, location: loc?) -> void
|
18
28
|
|
19
29
|
include _ToJson
|
20
30
|
end
|
@@ -68,19 +78,42 @@ module RBS
|
|
68
78
|
end
|
69
79
|
|
70
80
|
class Class < Base
|
71
|
-
type member = Members::t | t
|
72
|
-
|
73
81
|
class Super
|
82
|
+
# String
|
83
|
+
# ^^^^^^ name
|
84
|
+
#
|
85
|
+
# Array[String]
|
86
|
+
# ^^^^^ name
|
87
|
+
# ^^^^^^^^ args
|
88
|
+
#
|
89
|
+
type loc = Location::WithChildren[:name, :args]
|
90
|
+
|
74
91
|
attr_reader name: TypeName
|
75
92
|
attr_reader args: Array[Types::t]
|
76
|
-
attr_reader location:
|
93
|
+
attr_reader location: loc?
|
77
94
|
|
78
|
-
def initialize: (name: TypeName, args: Array[Types::t], location:
|
95
|
+
def initialize: (name: TypeName, args: Array[Types::t], location: loc?) -> void
|
79
96
|
|
80
97
|
include _HashEqual
|
81
98
|
include _ToJson
|
82
99
|
end
|
83
100
|
|
101
|
+
type member = Members::t | t
|
102
|
+
|
103
|
+
# class Foo end
|
104
|
+
# ^^^^^ keyword
|
105
|
+
# ^^^ name
|
106
|
+
# ^^^ end
|
107
|
+
#
|
108
|
+
# class Foo[A] < String end
|
109
|
+
# ^^^^^ keyword
|
110
|
+
# ^^^ name
|
111
|
+
# ^^^ type_params
|
112
|
+
# ^ lt
|
113
|
+
# ^^^ end
|
114
|
+
#
|
115
|
+
type loc = Location::WithChildren[:keyword | :name | :end, :type_params | :lt]
|
116
|
+
|
84
117
|
include NestedDeclarationHelper
|
85
118
|
include MixinHelper
|
86
119
|
|
@@ -89,24 +122,28 @@ module RBS
|
|
89
122
|
attr_reader members: Array[member]
|
90
123
|
attr_reader super_class: Super?
|
91
124
|
attr_reader annotations: Array[Annotation]
|
92
|
-
attr_reader location:
|
125
|
+
attr_reader location: loc?
|
93
126
|
attr_reader comment: Comment?
|
94
127
|
|
95
|
-
def initialize: (name: TypeName, type_params: ModuleTypeParams, members: Array[member], super_class: Super?, annotations: Array[Annotation], location:
|
128
|
+
def initialize: (name: TypeName, type_params: ModuleTypeParams, members: Array[member], super_class: Super?, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
96
129
|
|
97
130
|
include _HashEqual
|
98
131
|
include _ToJson
|
99
132
|
end
|
100
133
|
|
101
134
|
class Module < Base
|
102
|
-
type member = Members::t | t
|
103
|
-
|
104
135
|
class Self
|
136
|
+
# _Each[String]
|
137
|
+
# ^^^^^ name
|
138
|
+
# ^^^^^^^^ args
|
139
|
+
#
|
140
|
+
type loc = Location::WithChildren[:name, :args]
|
141
|
+
|
105
142
|
attr_reader name: TypeName
|
106
143
|
attr_reader args: Array[Types::t]
|
107
|
-
attr_reader location:
|
144
|
+
attr_reader location: loc?
|
108
145
|
|
109
|
-
def initialize: (name: TypeName, args: Array[Types::t], location:
|
146
|
+
def initialize: (name: TypeName, args: Array[Types::t], location: loc?) -> void
|
110
147
|
|
111
148
|
include _HashEqual
|
112
149
|
include _ToJson
|
@@ -114,18 +151,35 @@ module RBS
|
|
114
151
|
def to_s: () -> String
|
115
152
|
end
|
116
153
|
|
154
|
+
type member = Members::t | t
|
155
|
+
|
156
|
+
# module Foo end
|
157
|
+
# ^^^^^^ keyword
|
158
|
+
# ^^^ name
|
159
|
+
# ^^^ end
|
160
|
+
#
|
161
|
+
# module Foo[A] : BasicObject end
|
162
|
+
# ^^^^^^ keyword
|
163
|
+
# ^^^ name
|
164
|
+
# ^^^ type_params
|
165
|
+
# ^ colon
|
166
|
+
# ^^^^^^^^^^^ self_types
|
167
|
+
# ^^^ end
|
168
|
+
#
|
169
|
+
type loc = Location::WithChildren[:keyword | :name | :end, :type_params | :colon | :self_types]
|
170
|
+
|
117
171
|
include NestedDeclarationHelper
|
118
172
|
include MixinHelper
|
119
173
|
|
120
174
|
attr_reader name: TypeName
|
121
175
|
attr_reader type_params: ModuleTypeParams
|
122
176
|
attr_reader members: Array[member]
|
123
|
-
attr_reader location:
|
177
|
+
attr_reader location: loc?
|
124
178
|
attr_reader annotations: Array[Annotation]
|
125
179
|
attr_reader self_types: Array[Self]
|
126
180
|
attr_reader comment: Comment?
|
127
181
|
|
128
|
-
def initialize: (name: TypeName, type_params: ModuleTypeParams, members: Array[member], location:
|
182
|
+
def initialize: (name: TypeName, type_params: ModuleTypeParams, members: Array[member], location: loc?, annotations: Array[Annotation], self_types: Array[Self], comment: Comment?) -> void
|
129
183
|
|
130
184
|
include _HashEqual
|
131
185
|
include _ToJson
|
@@ -134,14 +188,27 @@ module RBS
|
|
134
188
|
class Interface
|
135
189
|
type member = Members::t
|
136
190
|
|
191
|
+
# interface _Foo end
|
192
|
+
# ^^^^^^^^^ keyword
|
193
|
+
# ^^^^ name
|
194
|
+
# ^^^ end
|
195
|
+
#
|
196
|
+
# interface _Bar[A, B] end
|
197
|
+
# ^^^^^^^^^ keyword
|
198
|
+
# ^^^^ name
|
199
|
+
# ^^^^^^ type_params
|
200
|
+
# ^^^ end
|
201
|
+
#
|
202
|
+
type loc = Location::WithChildren[:name | :keyword | :end, :type_params]
|
203
|
+
|
137
204
|
attr_reader name: TypeName
|
138
205
|
attr_reader type_params: ModuleTypeParams
|
139
206
|
attr_reader members: Array[member]
|
140
207
|
attr_reader annotations: Array[Annotation]
|
141
|
-
attr_reader location:
|
208
|
+
attr_reader location: loc?
|
142
209
|
attr_reader comment: Comment?
|
143
210
|
|
144
|
-
def initialize: (name: TypeName, type_params: ModuleTypeParams, members: Array[member], annotations: Array[Annotation], location:
|
211
|
+
def initialize: (name: TypeName, type_params: ModuleTypeParams, members: Array[member], annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
145
212
|
|
146
213
|
include MixinHelper
|
147
214
|
|
@@ -150,37 +217,55 @@ module RBS
|
|
150
217
|
end
|
151
218
|
|
152
219
|
class Alias < Base
|
220
|
+
# type loc = Location
|
221
|
+
# ^^^^ keyword
|
222
|
+
# ^^^ name
|
223
|
+
# ^ eq
|
224
|
+
type loc = Location::WithChildren[:keyword | :name | :eq, bot]
|
225
|
+
|
153
226
|
attr_reader name: TypeName
|
154
227
|
attr_reader type: Types::t
|
155
228
|
attr_reader annotations: Array[Annotation]
|
156
|
-
attr_reader location:
|
229
|
+
attr_reader location: loc?
|
157
230
|
attr_reader comment: Comment?
|
158
231
|
|
159
|
-
def initialize: (name: TypeName, type: Types::t, annotations: Array[Annotation], location:
|
232
|
+
def initialize: (name: TypeName, type: Types::t, annotations: Array[Annotation], location: loc?, comment: Comment?) -> void
|
160
233
|
|
161
234
|
include _HashEqual
|
162
235
|
include _ToJson
|
163
236
|
end
|
164
237
|
|
165
238
|
class Constant < Base
|
239
|
+
# VERSION: String
|
240
|
+
# ^^^^^^^ name
|
241
|
+
# ^ colon
|
242
|
+
#
|
243
|
+
type loc = Location::WithChildren[:name | :colon, bot]
|
244
|
+
|
166
245
|
attr_reader name: TypeName
|
167
246
|
attr_reader type: Types::t
|
168
|
-
attr_reader location:
|
247
|
+
attr_reader location: loc?
|
169
248
|
attr_reader comment: Comment?
|
170
249
|
|
171
|
-
def initialize: (name: TypeName, type: Types::t, location:
|
250
|
+
def initialize: (name: TypeName, type: Types::t, location: loc?, comment: Comment?) -> void
|
172
251
|
|
173
252
|
include _HashEqual
|
174
253
|
include _ToJson
|
175
254
|
end
|
176
255
|
|
177
256
|
class Global < Base
|
257
|
+
# $SIZE: String
|
258
|
+
# ^^^^^ name
|
259
|
+
# ^ colon
|
260
|
+
#
|
261
|
+
type loc = Location::WithChildren[:name | :colon, bot]
|
262
|
+
|
178
263
|
attr_reader name: Symbol
|
179
264
|
attr_reader type: Types::t
|
180
|
-
attr_reader location:
|
265
|
+
attr_reader location: loc?
|
181
266
|
attr_reader comment: Comment?
|
182
267
|
|
183
|
-
def initialize: (name: Symbol, type: Types::t, location:
|
268
|
+
def initialize: (name: Symbol, type: Types::t, location: loc?, comment: Comment?) -> void
|
184
269
|
|
185
270
|
include _HashEqual
|
186
271
|
include _ToJson
|