Copy risc compiler stuff to mom
Start to separate the layers. wip, just checkin in to see the following changes better
This commit is contained in:
@ -17,6 +17,26 @@ module ScopeHelper
|
||||
in_Test("def main(arg) ; #{statements}; end")
|
||||
end
|
||||
end
|
||||
module VoolCompile
|
||||
include ScopeHelper
|
||||
|
||||
def compile_method(input)
|
||||
statements = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_mom(input)
|
||||
assert statements.is_a?(Mom::MomCollection)
|
||||
ret = statements.to_mom(nil)
|
||||
assert_equal Parfait::Class , statements.clazz.class , statements
|
||||
@method = statements.clazz.get_method(:main)
|
||||
assert_equal Parfait::VoolMethod , @method.class
|
||||
ret
|
||||
end
|
||||
def compile_first_method( input )
|
||||
ret = compile_method( as_test_main( input ))
|
||||
assert_equal Mom::MomCompiler , ret.class
|
||||
compiler = ret.method_compilers.find{|c| c.get_method.name == :main and c.get_method.self_type.object_class.name == :Test}
|
||||
assert_equal Risc::MethodCompiler , compiler.class
|
||||
@method.source.to_mom( compiler )
|
||||
end
|
||||
end
|
||||
|
||||
module MomCompile
|
||||
include ScopeHelper
|
||||
@ -78,27 +98,3 @@ module MomCompile
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
class Ignored
|
||||
def == other
|
||||
return false unless other.class == self.class
|
||||
Sof::Util.attributes(self).each do |a|
|
||||
begin
|
||||
left = send(a)
|
||||
rescue NoMethodError
|
||||
next # not using instance variables that are not defined as attr_readers for equality
|
||||
end
|
||||
begin
|
||||
right = other.send(a)
|
||||
rescue NoMethodError
|
||||
return false
|
||||
end
|
||||
return false unless left.class == right.class
|
||||
return false unless left == right
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user