signature = moduleName + ":" + signature;
}
LocalQuickFix[] qfs = parent instanceof ErlangGenericFunctionCallExpression || parent instanceof ErlangGlobalFunctionCallExpression ?
new LocalQuickFix[]{} :
new LocalQuickFix[]{new ErlangCreateFunctionQuickFix(name, arity)};
holder.registerProblem(o.getNameIdentifier(), "Unresolved function " + "'" + signature + "'", qfs);
}
}
@Override
public void visitSpecFun(@NotNull ErlangSpecFun o) {
inspect(o, o.getQAtom(), o.getReference());
}
@Override
public void visitFunctionWithArity(@NotNull ErlangFunctionWithArity o) {
inspect(o, o.getQAtom(), o.getReference());
}
private void inspect(PsiElement what, ErlangQAtom target, @Nullable PsiReference reference) {
if (PsiTreeUtil.getParentOfType(what, ErlangCallbackSpec.class) != null || target.getMacros() != null ||
!(reference instanceof ErlangFunctionReferenceImpl) || reference.resolve() != null) {
return;
}
ErlangFunctionReferenceImpl r = (ErlangFunctionReferenceImpl) reference;
if (r.getArity() < 0) return; //there is no need to inspect incomplete/erroneous code
LocalQuickFix[] qfs = PsiTreeUtil.getNextSiblingOfType(what, ErlangModuleRef.class) != null ?
new LocalQuickFix[]{} : new LocalQuickFix[]{new ErlangCreateFunctionQuickFix(r.getName(), r.getArity())};
holder.registerProblem(target, "Unresolved function " + "'" + r.getSignature() + "'", qfs);
}
};
}