public ContinuationRequestorCalledToken evaluate(ContinuationScheduler requestor) { final List<CallC> possibleCallers = new ArrayList<CallC>(); boolean isMethod = (callable instanceof RubyMethod); // for (FileScope fileScope : searchService.searchForEverything()) { // PossibleCallsVisitor visitor = new PossibleCallsVisitor(callable.name(), // isMethod); // new RubyAstTraverser().traverse(fileScope.node(), visitor); // for (RubyProcedureCall node : visitor.possibleCalls()) { // Scope scope = RubyUtils.restoreScope(fileScope, node); // possibleCallers.add(new Construct<Scope, RubyProcedureCall>(scope, node)); // } // } String name = callable.name(); CallsRequestor cr = new CallsRequestor() { public void call(CallC call) { possibleCallers.add(call); } }; if (callable instanceof RubyMethod) searchService.findMethodCalls(name, cr); else searchService.findProcedureCalls(name, cr); CallC[] array = possibleCallers.toArray(createArray(possibleCallers.size())); if (!isMethod) { this.callers = new CallersInfo(array); return requestor.done(); } else return requestor.schedule(new MethodCallersRefiner(array)); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((callable == null) ? 0 : callable.hashCode()); return result; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final MethodCallersGoal other = (MethodCallersGoal) obj; if (callable == null) { if (other.callable != null) return false; } else if (!callable.equals(other.callable)) return false; return true; }