Class: Rubex::AST::Expression::ToRubyObject
- Inherits:
-
CoerceObject
- Object
- Base
- CoerceObject
- Rubex::AST::Expression::ToRubyObject
- Defined in:
- lib/rubex/ast/expression/to_ruby_object.rb
Overview
internal node for converting to ruby object.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
attr_reader :expr.
Attributes inherited from CoerceObject
Attributes inherited from Base
Instance Method Summary collapse
- #c_code(local_scope) ⇒ Object
-
#initialize(expr) ⇒ ToRubyObject
constructor
A new instance of ToRubyObject.
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) ⇒ ToRubyObject
Returns a new instance of ToRubyObject.
9 10 11 12 |
# File 'lib/rubex/ast/expression/to_ruby_object.rb', line 9 def initialize(expr) @expr = expr @type = Rubex::DataType::RubyObject.new end |
Instance Attribute Details
#type ⇒ Object (readonly)
attr_reader :expr
7 8 9 |
# File 'lib/rubex/ast/expression/to_ruby_object.rb', line 7 def type @type end |
Instance Method Details
#c_code(local_scope) ⇒ Object
14 15 16 17 18 |
# File 'lib/rubex/ast/expression/to_ruby_object.rb', line 14 def c_code(local_scope) t = @expr.type t = t.c_function? || t.alias_type? ? t.type : t t.to_ruby_object(@expr.c_code(local_scope)).to_s end |