Class: Rubex::AST::Expression::FromRubyObject

Inherits:
CoerceObject show all
Defined in:
lib/rubex/ast/expression/from_ruby_object.rb

Overview

internal node for converting from ruby object.

Instance Attribute Summary

Attributes inherited from CoerceObject

#expr

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

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

#initialize(expr, from_node) ⇒ FromRubyObject

expr - Expression to convert from_node - LHS expression. Of type Rubex::AST::Expression



8
9
10
11
12
# File 'lib/rubex/ast/expression/from_ruby_object.rb', line 8

def initialize(expr, from_node)
  @expr = expr
  @type = @expr.type
  @from_node = from_node
end

Instance Method Details

#c_code(local_scope) ⇒ Object



14
15
16
# File 'lib/rubex/ast/expression/from_ruby_object.rb', line 14

def c_code(local_scope)
  @from_node.type.from_ruby_object(@expr.c_code(local_scope)).to_s
end