Class: Duby::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
#actual_return_type ⇒ Object
107
108
109
|
# File 'lib/duby/jvm/types/methods.rb', line 107
def actual_return_type
return_type
end
|
#argument_types ⇒ Object
93
94
95
96
97
98
99
100
101
|
# File 'lib/duby/jvm/types/methods.rb', line 93
def argument_types
@argument_types ||= @member.argument_types.map do |arg|
if arg.kind_of?(AST::TypeReference) || arg.nil?
arg
else
AST.type(arg)
end
end
end
|
#call(compiler, ast, expression) ⇒ Object
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/duby/jvm/types/methods.rb', line 125
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
136
137
138
|
# File 'lib/duby/jvm/types/methods.rb', line 136
def constructor?
true
end
|
#declaring_class ⇒ Object
121
122
123
|
# File 'lib/duby/jvm/types/methods.rb', line 121
def declaring_class
AST.type(@member.declaring_class)
end
|
#exceptions ⇒ Object
111
112
113
114
115
116
117
118
119
|
# File 'lib/duby/jvm/types/methods.rb', line 111
def exceptions
@member.exception_types.map do |exception|
if exception.kind_of?(Duby::JVM::Types::Type)
exception
else
Duby::AST.type(exception.class_name)
end
end
end
|
#return_type ⇒ Object
103
104
105
|
# File 'lib/duby/jvm/types/methods.rb', line 103
def return_type
declaring_class
end
|