use of org.elixir_lang.reference.Callable in project intellij-elixir by KronicDeth.
the class ElixirPsiImplUtil method getReference.
@Nullable
public static PsiReference getReference(@NotNull Call call) {
PsiReference reference = null;
/* if the call is just the identifier for a module attribute reference, then don't return a Callable reference,
and instead let {@link #getReference(AtNonNumbericOperation) handle it */
if (!(call instanceof UnqualifiedNoArgumentsCall && call.getParent() instanceof AtNonNumericOperation) && // if a bitstring segment option then the option is a pseudo-function
!isBitStreamSegmentOption(call)) {
PsiElement parent = call.getParent();
if (parent instanceof Type) {
PsiElement grandParent = parent.getParent();
AtUnqualifiedNoParenthesesCall moduleAttribute = null;
PsiElement maybeArgument = grandParent;
if (grandParent instanceof When) {
maybeArgument = grandParent.getParent();
}
if (maybeArgument instanceof ElixirNoParenthesesOneArgument) {
PsiElement maybeModuleAttribute = maybeArgument.getParent();
if (maybeModuleAttribute instanceof AtUnqualifiedNoParenthesesCall) {
moduleAttribute = (AtUnqualifiedNoParenthesesCall) maybeModuleAttribute;
}
if (moduleAttribute != null) {
String name = moduleAttributeName(moduleAttribute);
if (name.equals("@spec")) {
reference = new org.elixir_lang.reference.CallDefinitionClause(call, moduleAttribute);
}
}
}
}
if (reference == null) {
if (CallDefinitionClause.is(call) || Implementation.is(call) || Module.is(call) || Protocol.is(call)) {
reference = Callable.definer(call);
} else {
reference = new Callable(call);
}
}
}
return reference;
}
Aggregations