Class: Malady::AST::IntegerNode

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

Instance Attribute Summary collapse

Attributes inherited from Node

#filename, #line

Instance Method Summary collapse

Methods inherited from Node

#pos

Constructor Details

#initialize(filename, line, value) ⇒ IntegerNode

Returns a new instance of IntegerNode.



55
56
57
58
# File 'lib/malady/ast.rb', line 55

def initialize(filename, line, value)
  super
  @value = value.to_i
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



53
54
55
# File 'lib/malady/ast.rb', line 53

def value
  @value
end

Instance Method Details

#bytecode(g) ⇒ Object



60
61
62
63
# File 'lib/malady/ast.rb', line 60

def bytecode(g)
  pos(g)
  g.push_int value
end