@Override
protected GoType[] resolveTypes() {
PsiElement target = resolveSafely(getIdentifier(), PsiElement.class);
if (target instanceof GoFunctionDeclaration) {
GoFunctionDeclaration functionDeclaration = (GoFunctionDeclaration) target;
return new GoType[]{
types().fromPsiType(functionDeclaration)
};
}
if (target != null && target.getParent() instanceof GoTypeStructField) {
GoTypeStructField structField = (GoTypeStructField) target.getParent();
return new GoType[]{types().fromPsiType(structField.getType())};
}
if (target instanceof GoTypeStructAnonymousField) {
GoTypeStructAnonymousField structField =
(GoTypeStructAnonymousField) target;
return new GoType[]{
types().fromPsiType(structField.getType())
};
}
if (target instanceof GoLiteralIdentifier) {
GoFunctionDeclaration functionDeclaration = GoIdentifierUtils.getFunctionDeclaration(target);
if (functionDeclaration != null) {
return new GoType[]{
types().fromPsiType(functionDeclaration)
};
}