Class: Mirah::JVM::Types::JavaConstructor
Instance Attribute Summary
Attributes inherited from JavaCallable
#member
Instance Method Summary
collapse
#field?, #initialize, #name, #parameter_types
#convert_args
Instance Method Details
#argument_types ⇒ Object
157
158
159
160
161
162
163
164
165
|
# File 'lib/mirah/jvm/types/methods.rb', line 157
def argument_types
@argument_types ||= @member.argument_types.map do |arg|
if arg.kind_of?(Type) || arg.nil?
arg
else
@types.type(nil, arg)
end
end
end
|
#call(compiler, ast, expression, parameters = nil, delegate = false) ⇒ Object
189
190
191
192
193
194
195
196
197
198
199
200
201
|
# File 'lib/mirah/jvm/types/methods.rb', line 189
def call(compiler, ast, expression, parameters=nil, delegate=false)
target = compiler.inferred_type(ast.target)
unless delegate
compiler.method.new target
compiler.method.dup if expression
end
parameters ||= ast.parameters
convert_args(compiler, parameters)
compiler.method.invokespecial(
target,
"<init>",
[nil, *@member.argument_types])
end
|
#constructor? ⇒ Boolean
203
204
205
|
# File 'lib/mirah/jvm/types/methods.rb', line 203
def constructor?
true
end
|
#declaring_class ⇒ Object
181
182
183
|
# File 'lib/mirah/jvm/types/methods.rb', line 181
def declaring_class
@types.type(nil, @member.declaring_class)
end
|
#exceptions ⇒ Object
171
172
173
174
175
176
177
178
179
|
# File 'lib/mirah/jvm/types/methods.rb', line 171
def exceptions
@member.exception_types.map do |exception|
if exception.kind_of?(ResolvedType)
exception
else
@types.type(nil, exception.class_name)
end
end
end
|
#return_type ⇒ Object
167
168
169
|
# File 'lib/mirah/jvm/types/methods.rb', line 167
def return_type
declaring_class
end
|
#type_parameters ⇒ Object
185
186
187
|
# File 'lib/mirah/jvm/types/methods.rb', line 185
def type_parameters
@declaring_class and @declaring_class.jvm_type.type_parameters
end
|
#varargs? ⇒ Boolean
207
208
209
|
# File 'lib/mirah/jvm/types/methods.rb', line 207
def varargs?
@member.varargs?
end
|