Class: Rubex::AST::Expression::UnaryNot

Inherits:
UnaryBase show all
Defined in:
lib/rubex/ast/expression/unary_base/unary_not.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#entry, #typecast

Instance Method Summary collapse

Methods inherited from UnaryBase

#analyse_types, #generate_evaluation_code, #initialize

Methods inherited from Base

#allocate_temp, #allocate_temps, #analyse_for_target_type, #analyse_types, #expression?, #from_ruby_object, #generate_and_dispose_subexprs, #generate_assignment_code, #generate_disposal_code, #generate_evaluation_code, #has_temp, #possible_typecast, #release_temp, #release_temps, #to_ruby_object

Constructor Details

This class inherits a constructor from Rubex::AST::Expression::UnaryBase

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



5
6
7
# File 'lib/rubex/ast/expression/unary_base/unary_not.rb', line 5

def type
  @type
end

Instance Method Details

#c_code(local_scope) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/rubex/ast/expression/unary_base/unary_not.rb', line 7

def c_code(local_scope)
  code = @expr.c_code(local_scope)
  if @type.object?
    "rb_funcall(#{code}, rb_intern(\"!\"), 0)"
  else
    "!#{code}"
  end
end