use of meghanada.analyze.MethodCall in project meghanada-server by mopemope.
the class ReferenceSearcher method searchMethodCallCondition.
private static Optional<SearchCondition> searchMethodCallCondition(Source source, int line, int col, String symbol) {
EntryMessage msg = log.traceEntry("line={} col={} symbol={}", line, col, symbol);
Optional<MethodCall> mcResult = source.getMethodCall(line, col, true);
Optional<SearchCondition> result = mcResult.map(mc -> {
String methodName = mc.name;
List<String> arguments = mc.getArguments();
String declaringClass = mc.declaringClass;
if (isNull(declaringClass)) {
return null;
}
MemberDescriptor method = searchMatchMethod(declaringClass, methodName, arguments).orElseGet(() -> searchMatchConstructor(declaringClass, arguments).orElse(null));
if (isNull(method)) {
// not match
return null;
}
MethodDescriptor md = (MethodDescriptor) method;
if (md.getMemberType().equals(CandidateUnit.MemberType.CONSTRUCTOR)) {
return new SearchCondition(mc.declaringClass, mc.name, SearchCondition.Type.CONSTRUCTOR, mc.getArguments());
}
return new SearchCondition(mc.declaringClass, mc.name, SearchCondition.Type.METHOD, mc.getArguments());
});
log.traceExit(msg);
return result;
}
Aggregations