Class: Rubex::AST::Expression::Ampersand

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

Instance Attribute Summary

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

Methods inherited from UnaryBase

#generate_evaluation_code, #initialize

Methods inherited from Base

#allocate_temp, #allocate_temps, #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 Method Details

#analyse_for_target_type(target_type, local_scope) ⇒ Object



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

def analyse_for_target_type(target_type, local_scope)
  @expr.analyse_for_target_type(target_type, local_scope)
  @type = DataType::CPtr.new @expr.type
end

#analyse_types(local_scope) ⇒ Object



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

def analyse_types(local_scope)
  @expr.analyse_types local_scope
  @type = DataType::CPtr.new @expr.type
end

#c_code(local_scope) ⇒ Object



15
16
17
# File 'lib/rubex/ast/expression/unary_base/ampersand.rb', line 15

def c_code(local_scope)
  "&#{@expr.c_code(local_scope)}"
end