class Malady::AST::Program

Attributes

body[R]

Public Class Methods

new(filename, line, body) click to toggle source
Calls superclass method Malady::AST::Node::new
# File lib/malady/ast.rb, line 19
def initialize(filename, line, body)
  super
  @body = body
end

Public Instance Methods

bytecode(g) click to toggle source
# File lib/malady/ast.rb, line 24
def bytecode(g)
  g.file = (filename || :"(malady)").to_sym
  pos(g)

  body.each_with_index do |expression, idx|
    expression.bytecode(g)
    g.pop unless idx == body.size - 1
  end

  g.finalize
end