Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove the iterator visitor. it's not required.

  • Loading branch information...
commit d32fd66b5761bf4a98d7f8998e8c32dcbc31b3df 1 parent fc8372b
@martinjandrews martinjandrews authored
View
12 lib/roodi/core/checking_visitor.rb
@@ -13,11 +13,17 @@ def initialize(*checks)
end
end
- def visit(node)
+ def visit(node)
checks = @checks[node.node_type]
checks.each {|check| check.evaluate_node(node)} unless checks.nil?
- nil
- end
+
+ visitable_nodes = node.is_language_node? ? node.sexp_body : node
+ visitable_nodes.each do |child|
+ if child.class == Sexp then
+ child.accept(self)
+ end
+ end
+ end
end
end
end
View
19 lib/roodi/core/iterator_visitor.rb
@@ -1,19 +0,0 @@
-module Roodi
- module Core
- class IteratorVisitor
- def initialize(payload)
- @payload = payload
- end
-
- def visit(visited)
- visited.accept(@payload)
- visitable_nodes = visited.is_language_node? ? visited.sexp_body : visited
- visitable_nodes.each do |child|
- if child.class == Sexp then
- child.accept(self)
- end
- end
- end
- end
- end
-end
View
3  lib/roodi/core/runner.rb
@@ -2,7 +2,6 @@
require 'yaml'
require 'roodi/core/checking_visitor'
-require 'roodi/core/iterator_visitor'
require 'roodi/core/parser'
require 'roodi/core/visitable_sexp'
@@ -22,7 +21,7 @@ def initialize(*checks)
def check(filename, content)
@checks ||= load_checks
node = parse(filename, content)
- node.accept(IteratorVisitor.new(CheckingVisitor.new(@checks))) if node
+ node.accept(CheckingVisitor.new(@checks)) if node
end
def check_content(content)
Please sign in to comment.
Something went wrong with that request. Please try again.