@@ -23,7 +23,9 @@ def c_type
23
23
end
24
24
end
25
25
26
- def java_type = options [ :kind ] || "Node"
26
+ def java_type
27
+ options [ :kind ] || "Node"
28
+ end
27
29
28
30
def java_cast
29
31
if options [ :kind ]
@@ -39,77 +41,119 @@ def java_cast
39
41
class NodeParam < Param
40
42
include KindTypes
41
43
42
- def rbs_class = "Node"
44
+ def rbs_class
45
+ "Node"
46
+ end
43
47
end
44
48
45
49
# This represents a parameter to a node that is itself a node and can be
46
50
# optionally null. We pass them as references and store them as references.
47
51
class OptionalNodeParam < Param
48
52
include KindTypes
49
53
50
- def rbs_class = "Node?"
54
+ def rbs_class
55
+ "Node?"
56
+ end
51
57
end
52
58
53
59
SingleNodeParam = -> ( node ) { NodeParam === node or OptionalNodeParam === node }
54
60
55
61
# This represents a parameter to a node that is a list of nodes. We pass them as
56
62
# references and store them as references.
57
63
class NodeListParam < Param
58
- def rbs_class = "Array[Node]"
59
- def java_type = "Node[]"
64
+ def rbs_class
65
+ "Array[Node]"
66
+ end
67
+ def java_type
68
+ "Node[]"
69
+ end
60
70
end
61
71
62
72
# This represents a parameter to a node that is a list of locations.
63
73
class LocationListParam < Param
64
- def rbs_class = "Array[Location]"
65
- def java_type = "Location[]"
74
+ def rbs_class
75
+ "Array[Location]"
76
+ end
77
+ def java_type
78
+ "Location[]"
79
+ end
66
80
end
67
81
68
82
# This represents a parameter to a node that is the ID of a string interned
69
83
# through the parser's constant pool.
70
84
class ConstantParam < Param
71
- def rbs_class = "Symbol"
72
- def java_type = "byte[]"
85
+ def rbs_class
86
+ "Symbol"
87
+ end
88
+ def java_type
89
+ "byte[]"
90
+ end
73
91
end
74
92
75
93
# This represents a parameter to a node that is a list of IDs that are
76
94
# associated with strings interned through the parser's constant pool.
77
95
class ConstantListParam < Param
78
- def rbs_class = "Array[Symbol]"
79
- def java_type = "byte[][]"
96
+ def rbs_class
97
+ "Array[Symbol]"
98
+ end
99
+ def java_type
100
+ "byte[][]"
101
+ end
80
102
end
81
103
82
104
# This represents a parameter to a node that is a string.
83
105
class StringParam < Param
84
- def rbs_class = "String"
85
- def java_type = "byte[]"
106
+ def rbs_class
107
+ "String"
108
+ end
109
+ def java_type
110
+ "byte[]"
111
+ end
86
112
end
87
113
88
114
# This represents a parameter to a node that is a location.
89
115
class LocationParam < Param
90
- def rbs_class = "Location"
91
- def java_type = "Location"
116
+ def rbs_class
117
+ "Location"
118
+ end
119
+ def java_type
120
+ "Location"
121
+ end
92
122
end
93
123
94
124
# This represents a parameter to a node that is a location that is optional.
95
125
class OptionalLocationParam < Param
96
- def rbs_class = "Location?"
97
- def java_type = "Location"
126
+ def rbs_class
127
+ "Location?"
128
+ end
129
+ def java_type
130
+ "Location"
131
+ end
98
132
end
99
133
100
134
# This represents an integer parameter.
101
135
class UInt32Param < Param
102
- def rbs_class = "Integer"
103
- def java_type = "int"
136
+ def rbs_class
137
+ "Integer"
138
+ end
139
+ def java_type
140
+ "int"
141
+ end
104
142
end
105
143
106
144
# This represents a set of flags. It is very similar to the UInt32Param, but can
107
145
# be directly embedded into the flags field on the struct and provides
108
146
# convenient methods for checking if a flag is set.
109
147
class FlagsParam < Param
110
- def rbs_class = "Integer"
111
- def java_type = "short"
112
- def kind = options . fetch ( :kind )
148
+ def rbs_class
149
+ "Integer"
150
+ end
151
+ def java_type
152
+ "short"
153
+ end
154
+ def kind
155
+ options . fetch ( :kind )
156
+ end
113
157
end
114
158
115
159
PARAM_TYPES = {
0 commit comments