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
108
109
110
111
112
113
114
115
116
|
# File 'lib/mirah/jvm/types/methods.rb', line 108
def argument_types
@argument_types ||= @member.argument_types.map do |arg|
if arg.kind_of?(AST::TypeReference) || arg.nil?
arg
else
AST.type(nil, arg)
end
end
end
|
#call(compiler, ast, expression) ⇒ Object
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/mirah/jvm/types/methods.rb', line 136
def call(compiler, ast, expression)
target = ast.target.inferred_type
compiler.method.new target
compiler.method.dup if expression
convert_args(compiler, ast.parameters)
compiler.method.invokespecial(
target,
"<init>",
[nil, *@member.argument_types])
end
|
#constructor? ⇒ Boolean
147
148
149
|
# File 'lib/mirah/jvm/types/methods.rb', line 147
def constructor?
true
end
|
#declaring_class ⇒ Object
132
133
134
|
# File 'lib/mirah/jvm/types/methods.rb', line 132
def declaring_class
AST.type(nil, @member.declaring_class)
end
|
#exceptions ⇒ Object
122
123
124
125
126
127
128
129
130
|
# File 'lib/mirah/jvm/types/methods.rb', line 122
def exceptions
@member.exception_types.map do |exception|
if exception.kind_of?(Mirah::JVM::Types::Type)
exception
else
Mirah::AST.type(nil, exception.class_name)
end
end
end
|
#return_type ⇒ Object
118
119
120
|
# File 'lib/mirah/jvm/types/methods.rb', line 118
def return_type
declaring_class
end
|