Class: Rubex::AST::Expression::Literal::RubySymbol

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

Instance Attribute Summary

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

Methods inherited from Base

#==, #c_name, #literal?

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

Constructor Details

#initialize(name) ⇒ RubySymbol

Returns a new instance of RubySymbol.



6
7
8
9
# File 'lib/rubex/ast/expression/literal/ruby_symbol.rb', line 6

def initialize(name)
  super(name[1..-1])
  @type = Rubex::DataType::RubySymbol.new
end

Instance Method Details

#c_code(_local_scope) ⇒ Object



15
16
17
# File 'lib/rubex/ast/expression/literal/ruby_symbol.rb', line 15

def c_code(_local_scope)
  @c_code
end

#generate_evaluation_code(_code, _local_scope) ⇒ Object



11
12
13
# File 'lib/rubex/ast/expression/literal/ruby_symbol.rb', line 11

def generate_evaluation_code(_code, _local_scope)
  @c_code = "ID2SYM(rb_intern(\"#{@name}\"))"
end