extracting processor comonality before adding a third

This commit is contained in:
Torsten Ruger 2016-12-21 10:51:33 +02:00
parent cfa0c23373
commit 8b05951883
4 changed files with 16 additions and 14 deletions

View File

@ -1,3 +1,4 @@
require_relative "compiler/total_processor"
require_relative "compiler/type_collector"
require_relative "compiler/method_collector"
require_relative "compiler/ruby_method"

View File

@ -1,6 +1,6 @@
module Melon
class MethodCollector < AST::Processor
class MethodCollector < TotalProcessor
def initialize
@methods = []
@ -25,11 +25,5 @@ module Melon
type
end
def handler_missing(node)
node.children.each do |kid |
process(kid) if kid.is_a?(AST::Node)
end
end
end
end

View File

@ -0,0 +1,12 @@
module Melon
class TotalProcessor < AST::Processor
def handler_missing(node)
node.children.each do |kid |
process(kid) if kid.is_a?(AST::Node)
end
end
end
end

View File

@ -1,6 +1,6 @@
module Melon
class TypeCollector < AST::Processor
class TypeCollector < TotalProcessor
def initialize
@ivars = {}
@ -24,10 +24,5 @@ module Melon
@ivars[var] = :Object #guess, can maybe guess better
end
def handler_missing(node)
node.children.each do |kid |
process(kid) if kid.is_a?(AST::Node)
end
end
end
end