Class: Rubex::AST::Expression::Literal::Base

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

Direct Known Subclasses

ArrayLit, CNull, Char, Double, False, HashLit, Int, Nil, RubySymbol, StringLit, True

Instance Attribute Summary

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(name) ⇒ Base

Returns a new instance of Base.



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

def initialize(name)
  @name = name
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
# File 'lib/rubex/ast/expression/literal.rb', line 23

def ==(other)
  self.class == other.class && @name == other.name
end

#c_code(local_scope) ⇒ Object



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

def c_code(local_scope)
  code = super
  code << @name
end

#c_nameObject



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

def c_name
  @name
end

#literal?Boolean

Returns:



19
20
21
# File 'lib/rubex/ast/expression/literal.rb', line 19

def literal?
  true
end