Class: Rubinius::ToolSet.current::TS::AST::NumberLiteral

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/ast/literals.rb

Direct Known Subclasses

FixnumLiteral

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, value) ⇒ NumberLiteral

Returns a new instance of NumberLiteral.



199
200
201
202
# File 'lib/rubinius/ast/literals.rb', line 199

def initialize(line, value)
  @line = line
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



197
198
199
# File 'lib/rubinius/ast/literals.rb', line 197

def value
  @value
end

Instance Method Details

#bytecode(g) ⇒ Object



204
205
206
207
208
# File 'lib/rubinius/ast/literals.rb', line 204

def bytecode(g)
  pos(g)

  g.push_unique_literal @value
end

#defined(g) ⇒ Object



210
211
212
# File 'lib/rubinius/ast/literals.rb', line 210

def defined(g)
  g.push_literal "expression"
end

#to_sexpObject



214
215
216
# File 'lib/rubinius/ast/literals.rb', line 214

def to_sexp
  [:lit, @value]
end