Class: Rubex::AST::Expression::UnaryBase

Inherits:
Base
  • Object
show all
Defined in:
lib/rubex/ast/expression/unary_base.rb

Direct Known Subclasses

Ampersand, UnaryBitNot, UnaryNot, UnarySub

Instance Attribute Summary

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

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, #has_temp, #possible_typecast, #release_temp, #release_temps, #to_ruby_object

Constructor Details

#initialize(expr) ⇒ UnaryBase

Returns a new instance of UnaryBase.



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

def initialize expr
  @expr = expr
end

Instance Method Details

#analyse_types(local_scope) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rubex/ast/expression/unary_base.rb', line 10

def analyse_types local_scope
  @expr.analyse_types local_scope
  @expr = @expr.to_ruby_object if @expr.type.object?
  @type = @expr.type
  @expr.allocate_temps local_scope
  @expr.release_temps local_scope
end

#generate_evaluation_code(code, local_scope) ⇒ Object



18
19
20
# File 'lib/rubex/ast/expression/unary_base.rb', line 18

def generate_evaluation_code code, local_scope
  @expr.generate_evaluation_code code, local_scope
end