Class: Duby::JVM::Types::JavaFieldSetter

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?

Methods inherited from JavaMethod

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

Methods inherited from JavaConstructor

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

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



339
340
341
# File 'lib/duby/jvm/types/methods.rb', line 339

def argument_types
  [AST.type(@member.type)]
end

#call(compiler, ast, expression) ⇒ Object



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/duby/jvm/types/methods.rb', line 343

def call(compiler, ast, expression)
  target = ast.target.inferred_type

  # TODO: assert that no args are being passed, though that should have failed lookup

  convert_args(compiler, ast.parameters)
  if @member.static?
    compiler.method.dup if expression
    compiler.method.putstatic(target, name, @member.type)
  else
    ast.target.compile(compiler, true)
    convert_args(compiler, ast.parameters)
    compiler.method.dup_x2 if expression
    compiler.method.putfield(target, name, @member.type)
  end
end

#return_typeObject



335
336
337
# File 'lib/duby/jvm/types/methods.rb', line 335

def return_type
  AST.type(@member.type)
end