Class: Mirah::JVM::Types::JavaDynamicMethod
- Inherits:
-
JavaMethod
- Object
- JavaCallable
- JavaConstructor
- JavaMethod
- Mirah::JVM::Types::JavaDynamicMethod
- Defined in:
- lib/mirah/jvm/types/methods.rb
Instance Attribute Summary
Attributes inherited from JavaCallable
Instance Method Summary collapse
- #argument_types ⇒ Object
- #call(compiler, ast, expression) ⇒ Object
- #declaring_class ⇒ Object
-
#initialize(name, *types) ⇒ JavaDynamicMethod
constructor
A new instance of JavaDynamicMethod.
- #return_type ⇒ Object
Methods inherited from JavaMethod
#abstract?, #call_special, #constructor?, #static?, #void?
Methods inherited from JavaConstructor
Methods inherited from JavaCallable
#field?, #name, #parameter_types
Methods included from ArgumentConversion
Constructor Details
#initialize(name, *types) ⇒ JavaDynamicMethod
Returns a new instance of JavaDynamicMethod.
259 260 261 262 |
# File 'lib/mirah/jvm/types/methods.rb', line 259 def initialize(name, *types) @name = name @types = types end |
Instance Method Details
#argument_types ⇒ Object
272 273 274 |
# File 'lib/mirah/jvm/types/methods.rb', line 272 def argument_types @types end |
#call(compiler, ast, expression) ⇒ Object
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/mirah/jvm/types/methods.rb', line 276 def call(compiler, ast, expression) target = ast.target.inferred_type ast.target.compile(compiler, true) ast.parameters.each do |param| param.compile(compiler, true) end handle = compiler.method.mh_invokestatic( org.dynalang.dynalink.DefaultBootstrapper, "bootstrap", java.lang.invoke.CallSite, java.lang.invoke.MethodHandles::Lookup, java.lang.String, java.lang.invoke.MethodType) compiler.method.invokedynamic( "dyn:callPropWithThis:#{name}", [return_type, target, *@types], handle) unless expression return_type.pop(compiler.method) end end |
#declaring_class ⇒ Object
268 269 270 |
# File 'lib/mirah/jvm/types/methods.rb', line 268 def declaring_class java.lang.Object end |