Class: Mirah::JVM::Types::JavaFieldGetter

Inherits:
JavaFieldAccessor show all
Defined in:
lib/mirah/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?, #call_special, #constructor?, #return_type, #static?, #void?

Methods inherited from JavaConstructor

#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 Mirah::JVM::Types::JavaCallable

Instance Method Details

#argument_typesObject



320
321
322
# File 'lib/mirah/jvm/types/methods.rb', line 320

def argument_types
  []
end

#call(compiler, ast, expression) ⇒ Object



324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/mirah/jvm/types/methods.rb', line 324

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