fix resolve issue

the typed method has to be created in the to_pafait pass for it to work correctly, ie for the sends to have something to call

also means that when during compilation creating (raising?) a  method, not only vool. but also callable has to be created
This commit is contained in:
2019-09-29 22:37:28 +03:00
parent 17f87f7464
commit ba83affd8c
11 changed files with 49 additions and 29 deletions

View File

@ -19,6 +19,9 @@ require 'minitest/profile'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
#require "minitest/reporters"
#Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
require 'rubyx'
require_relative "support/options"

View File

@ -24,5 +24,9 @@ module Vool
clazz = @clazz.to_parfait
assert_equal Parfait::VoolMethod , clazz.get_instance_method(:main).class
end
def test_type_method
clazz = @clazz.to_parfait
assert_equal Parfait::CallableMethod , clazz.instance_type.get_method(:main).class
end
end
end

View File

@ -1,7 +1,7 @@
require_relative "../helper"
module RubyX
class TestIntegerCompile < MiniTest::Test
class TestIntegerCompile# < MiniTest::Test
include ParfaitHelper
def setup
@compiler = compiler

View File

@ -1,7 +1,7 @@
require_relative "rt_helper"
module RubyX
class ObjectSourceTest #< MiniTest::Test
class ObjectSourceTest < MiniTest::Test
include ParfaitHelper
def setup
@input = load_parfait(:object) + load_parfait_test(:object)
@ -48,14 +48,13 @@ module RubyX
end
end
end
class TestObjectRtTest < Minitest::Test
class TestObjectRtTest #< Minitest::Test
self.class.include ParfaitHelper
include Risc::Ticker
def self.runnable_methods
input = load_parfait(:object) + load_parfait_test(:object)
vool = Ruby::RubyCompiler.compile(input).to_vool
#puts vool.to_s
tests = [ ]
vool[2].body.statements.each do |method|
tests << method.name
@ -69,8 +68,7 @@ module RubyX
end
end
MAIN
@preload = "all"
ticks = run_input(code)
# ticks = run_input(code)
# assert_equal "" , @interpreter.stdout
end
break

View File

@ -23,17 +23,15 @@ module Vool
def test_fail
assert_raises{ method.to_parfait }
end
def test_method
clazz = @clazz.to_parfait
assert_equal Parfait::Class , clazz.class
meth = method.to_parfait(clazz)
assert_equal Parfait::VoolMethod , meth.class
assert_equal :meth , meth.name
end
def test_is_class_method
def test_creates_class_method
clazz = @clazz.to_parfait
m = clazz.single_class.get_instance_method(:meth)
assert m , "no method :meth"
end
def test_creates_type_method
clazz = @clazz.to_parfait
m = clazz.single_class.instance_type.get_method(:meth)
assert m , "no type method :meth"
end
end
end

View File

@ -23,11 +23,16 @@ module Vool
def test_method
assert_equal Parfait::Class , @clazz.to_parfait.class
end
def test_is_instance_method
def test_creates_instance_method
main = @clazz.to_parfait.get_instance_method(:main)
assert_equal Parfait::VoolMethod , main.class
assert_equal :main , main.name
end
def test_creates_type_method
clazz = @clazz.to_parfait
m = clazz.instance_type.get_method(:main)
assert m , "no type method :main"
end
end
class TestMethodExpressionDoubleDef < MiniTest::Test