better name for cool compile

This commit is contained in:
Torsten Ruger 2018-03-12 17:23:16 +05:30
parent 5fe0ba06ab
commit d910c02b4a
6 changed files with 17 additions and 17 deletions

View File

@ -3,7 +3,7 @@ require_relative "ruby_compiler"
module Vool
class VoolCompiler
def self.compile( ruby_source )
def self.ruby_to_vool( ruby_source )
statements = RubyCompiler.compile( ruby_source )
statements.create_objects
statements

View File

@ -22,7 +22,7 @@ module MomCompile
include CompilerHelper
def compile_first_method input
lst = Vool::VoolCompiler.compile as_test_main( input )
lst = Vool::VoolCompiler.ruby_to_vool as_test_main( input )
assert_equal Parfait::Class , lst.clazz.class , input
@method = lst.clazz.get_method(:main)
assert_equal Parfait::VoolMethod , @method.class

View File

@ -9,7 +9,7 @@ module Vool
end
def compile_in_test input
VoolCompiler.compile in_Test(input)
VoolCompiler.ruby_to_vool in_Test(input)
itest = Parfait.object_space.get_class_by_name(:Test)
assert itest
itest
@ -27,25 +27,25 @@ module Vool
def test_doesnt_create_existing_clas
space_class = Parfait.object_space.get_class_by_name(:Space)
VoolCompiler.compile "class Space ; end"
VoolCompiler.ruby_to_vool "class Space ; end"
clazz = Parfait.object_space.get_class_by_name(:Space)
assert_equal clazz , space_class
end
def test_class_body_is_scope
clazz = VoolCompiler.compile in_Test("def meth; @ivar ;end")
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
assert_equal ScopeStatement , clazz.body.class
end
def test_creates_class_without_deriviation
VoolCompiler.compile "class Testing ; end"
VoolCompiler.ruby_to_vool "class Testing ; end"
clazz = Parfait.object_space.get_class_by_name(:Testing)
assert clazz , "No classes created"
assert_equal :Object , clazz.super_class_name
end
def test_creates_class_with_deriviation
VoolCompiler.compile "class Test2 < List ;end"
VoolCompiler.ruby_to_vool "class Test2 < List ;end"
clazz = Parfait.object_space.get_class_by_name(:Test2)
assert clazz, "No classes created"
assert_equal :List , clazz.super_class_name
@ -53,14 +53,14 @@ module Vool
def test_space_is_unchanged_by_compile
space1 = Parfait.object_space.get_class_by_name(:Space)
VoolCompiler.compile "class Space ;end"
VoolCompiler.ruby_to_vool "class Space ;end"
space2 = Parfait.object_space.get_class_by_name(:Space)
assert_equal space1 , space2
end
def test_space_type_is_unchanged_by_compile
space1 = Parfait.object_space.get_class_by_name(:Space).instance_type
VoolCompiler.compile "class Space ;end"
VoolCompiler.ruby_to_vool "class Space ;end"
space2 = Parfait.object_space.get_class_by_name(:Space).instance_type
assert_equal space1 , space2
end

View File

@ -5,7 +5,7 @@ module Vool
class TestIvarCollect < MiniTest::Test
def compile(input)
lst = VoolCompiler.compile( input )
lst = VoolCompiler.ruby_to_vool( input )
vars = []
lst.collect([]).each do |node|
node.add_ivar(vars)

View File

@ -5,7 +5,7 @@ module Vool
class TestLocalCollect < MiniTest::Test
def compile(input)
lst = VoolCompiler.compile( input )
lst = VoolCompiler.ruby_to_vool( input )
vars = []
lst.collect([]).each do |node|
node.add_local(vars)

View File

@ -9,7 +9,7 @@ module Vool
end
def create_method
VoolCompiler.compile in_Test("def meth; @ivar ;end")
VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
test = Parfait.object_space.get_class_by_name(:Test)
test.get_method(:meth)
end
@ -38,27 +38,27 @@ module Vool
def test_creates_method_statement_in_class
clazz = VoolCompiler.compile in_Test("def meth; @ivar ;end")
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
assert_equal MethodStatement , clazz.body.statements.first.class
end
def test_parfait_class_creation
clazz = VoolCompiler.compile in_Test("def meth; @ivar ;end")
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
assert_equal Parfait::Class , clazz.body.statements.first.clazz.class
end
def test_method_statement_has_class
clazz = VoolCompiler.compile in_Test("def meth; @ivar ;end")
clazz = VoolCompiler.ruby_to_vool in_Test("def meth; @ivar ;end")
assert clazz.body.statements.first.clazz
end
def test_method_statement_has_class_in_main
clazz = VoolCompiler.compile as_main("def meth; @ivar ;end")
clazz = VoolCompiler.ruby_to_vool as_main("def meth; @ivar ;end")
assert clazz.body.statements.first.clazz
end
def test_method_has_one_local
VoolCompiler.compile in_Test("def meth; local = 5 ;end")
VoolCompiler.ruby_to_vool in_Test("def meth; local = 5 ;end")
test = Parfait.object_space.get_class_by_name(:Test)
method = test.get_method(:meth)
assert_equal 2 , method.locals_type.instance_length