Class: Duby::JVM::Types::JavaFieldGetter

Inherits:
JavaFieldAccessor show all
Defined in:
lib/duby/jvm/types/methods.rb

Instance Attribute Summary

Attributes inherited from JavaCallable

#member

Instance Method Summary collapse

Methods inherited from JavaFieldAccessor

#field?, #final?, #public?, #return_type

Methods inherited from JavaMethod

#abstract?, #actual_return_type, #call_special, #constructor?, #return_type, #static?, #void?

Methods inherited from JavaConstructor

#actual_return_type, #constructor?, #declaring_class, #exceptions, #return_type

Methods inherited from JavaCallable

#field?, #initialize, #name, #parameter_types

Methods included from ArgumentConversion

#convert_args

Constructor Details

This class inherits a constructor from Duby::JVM::Types::JavaCallable

Instance Method Details

#argument_typesObject



314
315
316
# File 'lib/duby/jvm/types/methods.rb', line 314

def argument_types
  []
end

#call(compiler, ast, expression) ⇒ Object



318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/duby/jvm/types/methods.rb', line 318

def call(compiler, ast, expression)
  target = ast.target.inferred_type
  
  # TODO: assert that no args are being passed, though that should have failed lookup

  if expression
    if @member.static?
      compiler.method.getstatic(target, name, @member.type)
    else
      ast.target.compile(compiler, true)
      compiler.method.getfield(target, name, @member.type)
    end
  end
end