Class: Mirah::JVM::Types::ComparisonIntrinsic

Inherits:
Intrinsic
  • Object
show all
Defined in:
lib/mirah/jvm/types/number.rb

Instance Attribute Summary collapse

Attributes inherited from Intrinsic

#argument_types, #return_type

Instance Method Summary collapse

Methods inherited from Intrinsic

#abstract?, #constructor?, #declaring_class, #exceptions, #field?, #isVararg, #varargs?

Methods included from ArgumentConversion

#convert_args

Constructor Details

#initialize(type, name, op, args) ⇒ ComparisonIntrinsic

Returns a new instance of ComparisonIntrinsic.



19
20
21
22
23
# File 'lib/mirah/jvm/types/number.rb', line 19

def initialize(type, name, op, args)
  super(type, name, args, type.type_system.type(nil, 'boolean')) do; end
  @type = type
  @op = op
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/mirah/jvm/types/number.rb', line 18

def name
  @name
end

#opObject (readonly)

Returns the value of attribute op.



18
19
20
# File 'lib/mirah/jvm/types/number.rb', line 18

def op
  @op
end

Instance Method Details

#accept(visitor, expression) ⇒ Object



39
40
41
# File 'lib/mirah/jvm/types/number.rb', line 39

def accept(visitor, expression)
  visitor.visitComparison(self, expression)
end

#call(compiler, call, expression) ⇒ Object



25
26
27
28
29
# File 'lib/mirah/jvm/types/number.rb', line 25

def call(compiler, call, expression)
  if expression
    @type.compile_boolean_operator(compiler, op, false, call, nil)
  end
end

#jump_if(compiler, call, label) ⇒ Object



31
32
33
# File 'lib/mirah/jvm/types/number.rb', line 31

def jump_if(compiler, call, label)
  @type.compile_boolean_operator(compiler, @op, false, call, label)
end

#jump_if_not(compiler, call, label) ⇒ Object



35
36
37
# File 'lib/mirah/jvm/types/number.rb', line 35

def jump_if_not(compiler, call, label)
  @type.compile_boolean_operator(compiler, @op, true, call, label)
end

#kindObject



43
44
45
# File 'lib/mirah/jvm/types/number.rb', line 43

def kind
  Java::OrgMirahJvmTypes::MemberKind::COMPARISON_OP
end