Skip to content

Commit

Permalink
Refactor usage of #method_calls_named
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed May 14, 2011
1 parent bb082c7 commit e202e4f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/jruby/lint/checkers/object_space.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def check(collector)
visitor = ::JRuby::Lint::AST::Visitor.new(collector.ast)
visitor.method_calls_named("each_object", "_id2ref").each do |node|
begin
next unless node.receiver_node.name == "ObjectSpace"
next unless node.receiver_node.node_type.to_s == "CONSTNODE" && node.receiver_node.name == "ObjectSpace"
next if node.args_node && node.args_node.size == 1 &&
%w(Class Module).include?(node.args_node[0].name)
add_finding(collector, node)
Expand Down
5 changes: 1 addition & 4 deletions lib/jruby/lint/checkers/thread_critical.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ class ThreadCritical

def check(collector)
visitor = ::JRuby::Lint::AST::Visitor.new(collector.ast)
visitor.select do |node|
::JRuby::Lint::AST::Visitor::METHOD_NODES.include?(node.node_type.to_s) &&
node.name =~ /^critical=?$/
end.each do |node|
visitor.method_calls_named("critical", "critical=").each do |node|
begin
if node.receiver_node.node_type.to_s == "CONSTNODE" && node.receiver_node.name == "Thread"
add_finding(collector, node)
Expand Down

0 comments on commit e202e4f

Please sign in to comment.