actually start doing something in to_mom

though still dummy
This commit is contained in:
Torsten Ruger 2017-04-12 11:53:02 +03:00
parent 1deca34c23
commit 9c499c7a19
5 changed files with 43 additions and 2 deletions

View File

@ -5,3 +5,5 @@ module Mom
end
end
require_relative "slot_load"

6
lib/mom/slot_load.rb Normal file
View File

@ -0,0 +1,6 @@
module Mom
class SlotLoad < Instruction
end
end

View File

@ -14,6 +14,9 @@ module Vool
def add_local( array )
array << @name
end
def to_mom( method )
Mom::SlotLoad.new
end
end
class InstanceAssignment < Assignment
# used to collect type information

View File

@ -4,8 +4,14 @@ module Mom
class TestAssignemnt < MiniTest::Test
include CompilerHelper
def test_class_exists
assert Instruction.new
end
def setup
Risc.machine.boot
end
def compile_first input
lst = Vool::VoolCompiler.compile in_Space( input )
lst.to_mom( nil )
end
end
end

View File

@ -0,0 +1,24 @@
require_relative "helper"
module Vool
class TestAssignemnt < MiniTest::Test
include CompilerHelper
def setup
Risc.machine.boot
end
def compile_first_method input
lst = VoolCompiler.compile as_main( input )
assert_equal Parfait::Class , lst.clazz.class , input
method = lst.clazz.get_method(:main)
assert method
lst.to_mom( nil ).first
end
def test_class_compiles
meth = compile_first_method( "a = 5")
assert_equal Mom::SlotLoad , meth.first.class , meth
end
end
end