diff --git a/lib/vool/compiler.rb b/lib/vool/compiler.rb index 088d26f6..39ede5a1 100644 --- a/lib/vool/compiler.rb +++ b/lib/vool/compiler.rb @@ -69,9 +69,10 @@ module Vool def on_dsym raise "Not implemented dynamix symbols (with interpolation)" end - def on_kwbegin expression - ScopeStatement.new process_all( expression.children ) + def on_kwbegin statement + ScopeStatement.new process_all( statement.children ) end + alias :on_begin :on_kwbegin # Array + Hashes def on_array expression @@ -88,8 +89,10 @@ module Vool end #Variables + def on_lvar expression + LocalVariable.new(expression.children.first) + end def on_lvasgn expression - puts "EXP #{expression}" name = expression.children[0] value = process(expression.children[1]) LocalAssignment.new(name,value) @@ -148,25 +151,23 @@ module Vool end def on_send statement - puts "SEND #{statement}" kids = statement.children.dup receiver = kids.shift name = kids.shift arguments = kids - w = SendStatement.new() + w = SendStatement.new( name ) w.receiver = process(receiver) || SelfStatement.new - w.name = name w.arguments = process_all(arguments) w end - def on_name statement - NameStatement.new(statement.children.first) - end + # def on_name statement + # NameStatement.new(statement.children.first) + # end - def on_class_name expression - ClassStatement.new(expression.children.first) - end + # def on_class_name expression + # ClassStatement.new(expression.children.first) + # end def on_assignment statement name , value = *statement diff --git a/lib/vool/send_statement.rb b/lib/vool/send_statement.rb index 9836ce72..e231508d 100644 --- a/lib/vool/send_statement.rb +++ b/lib/vool/send_statement.rb @@ -1,5 +1,8 @@ module Vool class SendStatement < Statement attr_accessor :name , :receiver , :arguments + def initialize(name) + @name = name + end end end diff --git a/test/test_all.rb b/test/test_all.rb index c6c80f50..b9e59563 100644 --- a/test/test_all.rb +++ b/test/test_all.rb @@ -6,6 +6,8 @@ require_relative "lib/test_all" require_relative "rubyx/test_all" +require_relative "vool/test_all" + require_relative "parfait/test_all" require_relative "risc/test_all" diff --git a/test/vool/test_all.rb b/test/vool/test_all.rb new file mode 100644 index 00000000..65f18f56 --- /dev/null +++ b/test/vool/test_all.rb @@ -0,0 +1,2 @@ +require_relative "helper" +require_relative "test_compiler" diff --git a/test/vool/test_variables.rb b/test/vool/test_variables.rb index 793b3bb9..b27ea87c 100644 --- a/test/vool/test_variables.rb +++ b/test/vool/test_variables.rb @@ -5,10 +5,10 @@ module Vool # "free standing" local can not be tested as it will result in send # in other words ther is no way of knowing if a name is variable or method - def ptest_send_to_local - lst = Compiler.compile( "foo = 1 ; foo.bar") - assert_equal LocalVariable , lst.receiver - end + # def test_send_to_local + # lst = Compiler.compile( "foo.bar") + # assert_equal SendStatement , lst.class + # end end end