Class: Rubex::AST::Expression::ToRubyObject
- Inherits:
-
CoerceObject
- Object
- Base
- CoerceObject
- Rubex::AST::Expression::ToRubyObject
- Defined in:
- lib/rubex/ast/expression.rb
Overview
internal node for converting to ruby object.
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
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_statement, #expression?, #from_ruby_object, #generate_assignment_code, #generate_disposal_code, #generate_evaluation_code, #possible_typecast, #release_temp, #release_temps, #to_ruby_object
Constructor Details
#initialize(expr) ⇒ ToRubyObject
Returns a new instance of ToRubyObject.
916 917 918 919 |
# File 'lib/rubex/ast/expression.rb', line 916 def initialize expr @expr = expr @type = Rubex::DataType::RubyObject.new end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
914 915 916 |
# File 'lib/rubex/ast/expression.rb', line 914 def type @type end |
Instance Method Details
#c_code(local_scope) ⇒ Object
921 922 923 924 925 |
# File 'lib/rubex/ast/expression.rb', line 921 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))}" end |