fix word implementation and tests

much better, though wasteful implementation
breaks a few tests, but ploughing on first
This commit is contained in:
Torsten Ruger
2015-05-15 16:45:36 +03:00
parent 164816c441
commit 0731a6061a
8 changed files with 155 additions and 55 deletions

View File

@ -71,7 +71,7 @@ module Virtual
# attr_reader :string
def self.compile_string expression , method
value = Parfait::Word.new(expression.string)
value = Parfait.new_word(expression.string)
to = Return.new(Reference , value)
Machine.instance.space.add_object value
method.add_code Set.new( to , value )

View File

@ -8,7 +8,7 @@ module Virtual
me = Compiler.compile( expession.receiver , method )
method.add_code NewMessage.new
method.add_code Set.new(NewSelf.new(me.type), me)
method.add_code Set.new(NewName.new(), Parfait::Word.new(expession.name))
method.add_code Set.new(NewName.new(), Parfait.new_word(expession.name))
compiled_args = []
expession.args.each_with_index do |arg , i|
#compile in the running method, ie before passing control

View File

@ -26,7 +26,7 @@ module Virtual
# compile the false block
method.current false_block
expression.if_false.each do |part|
puts "compiling in if false #{part}"
#puts "compiling in if false #{part}"
last = Compiler.compile(part,method )
raise part.inspect if last.nil?
end