actually start doing something in to_mom
though still dummy
This commit is contained in:
parent
1deca34c23
commit
9c499c7a19
@ -5,3 +5,5 @@ module Mom
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require_relative "slot_load"
|
||||||
|
6
lib/mom/slot_load.rb
Normal file
6
lib/mom/slot_load.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module Mom
|
||||||
|
|
||||||
|
class SlotLoad < Instruction
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -14,6 +14,9 @@ module Vool
|
|||||||
def add_local( array )
|
def add_local( array )
|
||||||
array << @name
|
array << @name
|
||||||
end
|
end
|
||||||
|
def to_mom( method )
|
||||||
|
Mom::SlotLoad.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
class InstanceAssignment < Assignment
|
class InstanceAssignment < Assignment
|
||||||
# used to collect type information
|
# used to collect type information
|
||||||
|
@ -4,8 +4,14 @@ module Mom
|
|||||||
class TestAssignemnt < MiniTest::Test
|
class TestAssignemnt < MiniTest::Test
|
||||||
include CompilerHelper
|
include CompilerHelper
|
||||||
|
|
||||||
def test_class_exists
|
def setup
|
||||||
assert Instruction.new
|
Risc.machine.boot
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def compile_first input
|
||||||
|
lst = Vool::VoolCompiler.compile in_Space( input )
|
||||||
|
lst.to_mom( nil )
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
24
test/vool/to_mom/test_assignemnt.rb
Normal file
24
test/vool/to_mom/test_assignemnt.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user