getting some sof output and adding some tests. issues though. abound

This commit is contained in:
Torsten Ruger
2014-08-14 17:40:56 +03:00
parent 7e60827dd3
commit 2c2ae14928
7 changed files with 104 additions and 23 deletions

View File

@ -19,7 +19,11 @@ module Virtual
@codes = []
end
attr_reader :name , :next , :codes , :method
def attributes
[:name , :codes , :branch]
end
attr_reader :name , :codes , :method
attr_accessor :branch
def reachable ret = []

View File

@ -12,7 +12,7 @@ module Virtual
# This is partly because jumping over this layer and doing in straight in assember was too big a step
class Instruction < Virtual::Object
# simple thought: don't recurse for labels, just check their names
# simple thought: don't recurse for Blocks, just check their names
def == other
return false unless other.class == self.class
attributes.each do |a|
@ -27,7 +27,9 @@ module Virtual
end
return true
end
def attributes
[]
end
end
module Named

View File

@ -35,7 +35,7 @@ module Virtual
MethodDefinition.new(:main , [] , Virtual::SelfReference )
end
def attributes
[:name , :args , :receiver , :return_type , :start]
[:name , :args , :receiver , :return_type , :blocks]
end
def initialize name , args , receiver = Virtual::SelfReference.new , return_type = Virtual::Mystery , start = MethodEnter.new()
@name = name.to_sym