Class: Rubex::AST::Expression::BinaryBoolean

Inherits:
Binary
  • Object
show all
Defined in:
lib/rubex/ast/expression/binary/binary_boolean.rb

Instance Attribute Summary

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

Methods inherited from Binary

#==, #c_code, #generate_evaluation_code, #initialize

Methods inherited from Base

#allocate_temp, #allocate_temps, #analyse_for_target_type, #c_code, #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::Binary

Instance Method Details

#analyse_types(local_scope) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rubex/ast/expression/binary/binary_boolean.rb', line 5

def analyse_types(local_scope)
  @left.analyse_types local_scope
  @right.analyse_for_target_type @left.type, local_scope
  if type_of(@left).object? || type_of(@right).object?
    
    @left = @left.to_ruby_object
    @right = @right.to_ruby_object
    @type = Rubex::DataType::Boolean.new
    @has_temp = true
  else
    @type = Rubex::DataType::CBoolean.new
  end
  @subexprs << @left
  @subexprs << @right
end