Class: CodeTools::AST::NumberLiteral

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

Direct Known Subclasses

FixnumLiteral, ImaginaryLiteral, RationalLiteral

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.



243
244
245
246
# File 'lib/rubinius/code/ast/literals.rb', line 243

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

Instance Attribute Details

#valueObject

Returns the value of attribute value.



241
242
243
# File 'lib/rubinius/code/ast/literals.rb', line 241

def value
  @value
end

Instance Method Details

#bytecode(g) ⇒ Object



248
249
250
251
252
# File 'lib/rubinius/code/ast/literals.rb', line 248

def bytecode(g)
  pos(g)

  g.push_literal @value
end

#defined(g) ⇒ Object



254
255
256
# File 'lib/rubinius/code/ast/literals.rb', line 254

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

#to_sexpObject



258
259
260
# File 'lib/rubinius/code/ast/literals.rb', line 258

def to_sexp
  [:lit, @value]
end