Class: CodeTools::AST::FloatLiteral

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

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, str) ⇒ FloatLiteral

Returns a new instance of FloatLiteral.



95
96
97
98
# File 'lib/rubinius/code/ast/literals.rb', line 95

def initialize(line, str)
  @line = line
  @value = str.to_f
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



93
94
95
# File 'lib/rubinius/code/ast/literals.rb', line 93

def value
  @value
end

Instance Method Details

#bytecode(g) ⇒ Object



100
101
102
103
104
# File 'lib/rubinius/code/ast/literals.rb', line 100

def bytecode(g)
  pos(g)

  g.push_float @value
end

#defined(g) ⇒ Object



106
107
108
# File 'lib/rubinius/code/ast/literals.rb', line 106

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

#to_sexpObject



110
111
112
# File 'lib/rubinius/code/ast/literals.rb', line 110

def to_sexp
  [:lit, @value]
end