From 02807cf6f98ff038692114512395cca41754c813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20R=C3=BCger?= Date: Mon, 19 Aug 2019 10:31:11 +0300 Subject: [PATCH] Rename Block to RubyBlock at Ruby level The parser presents the whole call that defines the block as a block. And so does the Ruby layer, as we don't want to do processing in ast. Just making it clearer, also Vool:: block will have to be renamed --- lib/ruby/{block_statement.rb => ruby_block_statement.rb} | 2 +- lib/ruby/ruby_compiler.rb | 3 ++- .../{test_block_statement.rb => test_ruby_block_statement.rb} | 2 +- ...{test_block_statement1.rb => test_ruby_block_statement1.rb} | 2 +- test/rubyx/parfait/test_object.rb | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) rename lib/ruby/{block_statement.rb => ruby_block_statement.rb} (97%) rename test/ruby/{test_block_statement.rb => test_ruby_block_statement.rb} (96%) rename test/ruby/{test_block_statement1.rb => test_ruby_block_statement1.rb} (96%) diff --git a/lib/ruby/block_statement.rb b/lib/ruby/ruby_block_statement.rb similarity index 97% rename from lib/ruby/block_statement.rb rename to lib/ruby/ruby_block_statement.rb index 42e57cff..aea499ed 100644 --- a/lib/ruby/block_statement.rb +++ b/lib/ruby/ruby_block_statement.rb @@ -5,7 +5,7 @@ module Ruby # A block is in essence quite like a method, so the block definition is like a # method definition, except it is not bound to the class direcly, but the enclosing # method. The enclosing method also provides the scope. - class BlockStatement < Statement + class RubyBlockStatement < Statement attr_reader :send , :args , :body def initialize( send , args , body ) diff --git a/lib/ruby/ruby_compiler.rb b/lib/ruby/ruby_compiler.rb index 01b8ebfa..230dd5bb 100644 --- a/lib/ruby/ruby_compiler.rb +++ b/lib/ruby/ruby_compiler.rb @@ -76,10 +76,11 @@ module Ruby end def on_block(block_node) + puts block_node.to_s sendd = process(block_node.children[0]) args = process(block_node.children[1]) body = process(block_node.children[2]) - BlockStatement.new(sendd , args , body) + RubyBlockStatement.new(sendd , args , body) end def on_yield(node) diff --git a/test/ruby/test_block_statement.rb b/test/ruby/test_ruby_block_statement.rb similarity index 96% rename from test/ruby/test_block_statement.rb rename to test/ruby/test_ruby_block_statement.rb index 9421161f..5912e7f9 100644 --- a/test/ruby/test_block_statement.rb +++ b/test/ruby/test_ruby_block_statement.rb @@ -9,7 +9,7 @@ module Ruby @lst = compile( input ) end def test_block - assert_equal BlockStatement , @lst.class + assert_equal RubyBlockStatement , @lst.class end def test_send assert_equal SendStatement , @lst.send.class diff --git a/test/ruby/test_block_statement1.rb b/test/ruby/test_ruby_block_statement1.rb similarity index 96% rename from test/ruby/test_block_statement1.rb rename to test/ruby/test_ruby_block_statement1.rb index f629d853..9d5cc746 100644 --- a/test/ruby/test_block_statement1.rb +++ b/test/ruby/test_ruby_block_statement1.rb @@ -15,7 +15,7 @@ module Ruby assert_equal LocalAssignment , @lst.first.class end def test_assign_right - assert_equal BlockStatement , @lst.first.value.class + assert_equal RubyBlockStatement , @lst.first.value.class end def test_method_name assert_equal :plus_one , @lst.first.value.send.name diff --git a/test/rubyx/parfait/test_object.rb b/test/rubyx/parfait/test_object.rb index 0f787754..8dd2e778 100644 --- a/test/rubyx/parfait/test_object.rb +++ b/test/rubyx/parfait/test_object.rb @@ -2,7 +2,7 @@ require_relative "helper" module RubyX - class TestObjecCompile < MiniTest::Test + class TestObjectCompile < MiniTest::Test include ParfaitHelper def source load_parfait(:object)