rename ClassCompiler to MomComplier
ended up not even using the class, it just came from there It actually compiles methods, and it turns out is the point where builtin comes into the picture as it's boot process also returns method compilers
This commit is contained in:
parent
c947c27a14
commit
bb49f1be78
@ -15,4 +15,4 @@ module Mom
|
||||
end
|
||||
|
||||
require_relative "instruction/instruction.rb"
|
||||
require_relative "class_compiler"
|
||||
require_relative "mom_compiler"
|
||||
|
@ -1,10 +1,9 @@
|
||||
module Mom
|
||||
class ClassCompiler
|
||||
class MomCompiler
|
||||
attr_reader :clazz , :method_compilers
|
||||
|
||||
def initialize(clazz , compilers)
|
||||
@clazz = clazz
|
||||
@method_compilers = compilers
|
||||
def initialize(compilers = [])
|
||||
@method_compilers = Builtin.boot_functions + compilers
|
||||
end
|
||||
|
||||
# Translate code to whatever cpu is specified.
|
@ -29,7 +29,7 @@ module Vool
|
||||
raise "Only methods for now #{node}" unless node.is_a?(MethodStatement)
|
||||
method_compilers << node.to_mom(@clazz)
|
||||
end
|
||||
Mom::ClassCompiler.new(@clazz , method_compilers)
|
||||
Mom::MomCompiler.new(method_compilers)
|
||||
end
|
||||
|
||||
def each(&block)
|
||||
|
@ -1,7 +1,7 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Mom
|
||||
class TestClassCompiler < MiniTest::Test
|
||||
class TestMomCompiler < MiniTest::Test
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
@ -10,7 +10,7 @@ module Mom
|
||||
end
|
||||
|
||||
def test_class
|
||||
assert_equal ClassCompiler , @comp.class
|
||||
assert_equal MomCompiler , @comp.class
|
||||
end
|
||||
def test_compilers
|
||||
assert_equal 1 , @comp.method_compilers.length
|
||||
@ -19,7 +19,7 @@ module Mom
|
||||
assert @comp.translate(:interpreter)
|
||||
end
|
||||
end
|
||||
class TestClassCompilerTranslate < MiniTest::Test
|
||||
class TestMomCompilerTranslate < MiniTest::Test
|
||||
include MomCompile
|
||||
|
||||
def setup
|
@ -11,7 +11,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_return_class
|
||||
assert_equal Mom::ClassCompiler , @ret.class
|
||||
assert_equal Mom::MomCompiler , @ret.class
|
||||
end
|
||||
def test_has_compilers
|
||||
assert_equal Risc::MethodCompiler , @ret.method_compilers.first.class
|
||||
|
Loading…
Reference in New Issue
Block a user