Class: RLSL::Prism::IR::Literal

Inherits:
Node
  • Object
show all
Defined in:
lib/rlsl/prism/ir/expressions.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#type

Instance Method Summary collapse

Methods inherited from Node

#accept, visits

Constructor Details

#initialize(value, type = nil) ⇒ Literal

Returns a new instance of Literal.



47
48
49
50
51
# File 'lib/rlsl/prism/ir/expressions.rb', line 47

def initialize(value, type = nil)
  super()
  @value = value
  @type = type || (value.is_a?(Float) ? :float : :int)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



43
44
45
# File 'lib/rlsl/prism/ir/expressions.rb', line 43

def value
  @value
end