Skip to content

Commit

Permalink
fixing pointcut visitor
Browse files Browse the repository at this point in the history
git-svn-id: svn://rubyforge.org/var/svn/rkelly/trunk@169 bf63cea8-67a3-4864-ab90-c58634fce689
  • Loading branch information
aaronp committed Jan 25, 2008
1 parent 3324541 commit 3e32f06
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/rkelly/nodes/function_call_node.rb
Expand Up @@ -6,6 +6,11 @@ def initialize(value, arguments)
super(value)
@arguments = arguments
end

def ==(other)
super && @arguments == other.arguments
end
alias :=~ :==
end
end
end
3 changes: 2 additions & 1 deletion lib/rkelly/nodes/resolve_node.rb
@@ -1,14 +1,15 @@
module RKelly
module Nodes
class ResolveNode < Node
def =~(other)
def ==(other)
return true if super
if @value =~ /^[A-Z]/
klass = [Object, Module].find { |x| x.const_defined?(@value.to_sym) }
return true if klass && other.value.is_a?(klass)
end
false
end
alias :=~ :==
end
end
end
2 changes: 1 addition & 1 deletion lib/rkelly/visitors/pointcut_visitor.rb
Expand Up @@ -9,7 +9,7 @@ def initialize(ast)

ALL_NODES.each do |type|
define_method(:"visit_#{type}Node") do |o|
@matches << o if o =~ @ast
@matches << o if @ast =~ o
super
end
end
Expand Down

0 comments on commit 3e32f06

Please sign in to comment.