Class: Duby::JVM::Types::JavaMethod
Instance Method Summary
collapse
#argument_types, #declaring_class, #exceptions, #initialize, #name
#convert_args
Instance Method Details
#actual_return_type ⇒ Object
123
124
125
126
127
128
129
|
# File 'lib/duby/jvm/types/methods.rb', line 123
def actual_return_type
if @member.return_type
return_type
else
Void
end
end
|
#call(compiler, ast, expression) ⇒ Object
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'lib/duby/jvm/types/methods.rb', line 143
def call(compiler, ast, expression)
target = ast.target.inferred_type
ast.target.compile(compiler, true)
if expression && void?
compiler.method.dup
end
convert_args(compiler, ast.parameters)
if target.interface?
compiler.method.invokeinterface(
target,
name,
[@member.return_type, *@member.argument_types])
else
compiler.method.invokevirtual(
target,
name,
[@member.return_type, *@member.argument_types])
end
unless expression || void?
compiler.method.pop
end
end
|
#constructor? ⇒ Boolean
139
140
141
|
# File 'lib/duby/jvm/types/methods.rb', line 139
def constructor?
false
end
|
#return_type ⇒ Object
113
114
115
116
117
118
119
120
121
|
# File 'lib/duby/jvm/types/methods.rb', line 113
def return_type
@return_type ||= begin
if @member.return_type
AST.type(@member.return_type)
else
declaring_class
end
end
end
|
131
132
133
|
# File 'lib/duby/jvm/types/methods.rb', line 131
def static?
@member.static?
end
|
135
136
137
|
# File 'lib/duby/jvm/types/methods.rb', line 135
def void?
@member.return_type.nil?
end
|