Using MetaClass to compile class methods into

still #24, still wip
This commit is contained in:
Torsten Ruger
2019-02-17 14:37:50 +02:00
parent 3db7707614
commit e430701645
4 changed files with 25 additions and 34 deletions

View File

@ -20,10 +20,14 @@ module Vool
def to_mom( _ )
create_class_object
method_compilers = body.statements.collect do |node|
unless node.is_a?(MethodStatement) or node.is_a?(ClassMethodStatement)
case node
when MethodStatement
node.to_mom(@clazz)
when ClassMethodStatement
node.to_mom(@clazz.meta_class)
else
raise "Only methods for now #{node.class}:#{node}"
end
node.to_mom(@clazz)
end
Mom::MomCompiler.new(method_compilers)
end