Class: Predicator::Visitors::Instructions

Inherits:
Visitor
  • Object
show all
Defined in:
lib/predicator/visitors/instructions.rb

Constant Summary

Constants inherited from Visitor

Visitor::DISPATCH_CACHE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instructions = []) ⇒ Instructions

Returns a new instance of Instructions.



6
7
8
9
# File 'lib/predicator/visitors/instructions.rb', line 6

def initialize instructions=[]
  @instructions = instructions
  @label_locations = {}
end

Instance Attribute Details

#instructionsObject (readonly)

Returns the value of attribute instructions.



4
5
6
# File 'lib/predicator/visitors/instructions.rb', line 4

def instructions
  @instructions
end

Instance Method Details

#accept(ast) ⇒ Object



11
12
13
14
15
16
# File 'lib/predicator/visitors/instructions.rb', line 11

def accept ast
  super
  update_jumps
  remove_labels
  @instructions
end