@@ -193,7 +193,6 @@ private String searchGoVarDefinitionReferences(GoVarDefinition goVarDefinition)
193193 for (PsiReference psiReference : GoReferencesSearch .search (goVarDefinition )) {
194194 GoStatement statement = (GoStatement ) PsiTreeUtil .findFirstParent (psiReference .getElement (), element -> element instanceof GoStatement );
195195 if (statement == null ) continue ;
196- System .out .println ("statement " + statement .getText ());
197196 schema = findSchema (statement );
198197 if (!schema .isEmpty ()) return schema ;
199198
@@ -225,29 +224,32 @@ private static String findSchema(@NotNull GoStatement statement) {
225224 if (!schema .isEmpty ()) return schema ;
226225
227226 for (GoCallExpr goCallExpr : PsiTreeUtil .findChildrenOfType (statement , GoCallExpr .class )) {
227+
228228 GoCallableDescriptor descriptor = GormTypes .ORM_MODEL_CALLABLES_SET .find (goCallExpr , false );
229229 if (descriptor == null ) continue ;
230230
231231 Integer argumentIndex = GormTypes .GORM_MODEL_CALLABLES .get (descriptor );
232232
233- System .out .println ("argumentIndex " + argumentIndex );
234- System .out .println ("getExpressionList " + goCallExpr .getArgumentList ().getExpressionList ().get (argumentIndex ));
235-
236233 GoExpression argument = goCallExpr .getArgumentList ().getExpressionList ().get (argumentIndex );
237234
238235 if (argument instanceof GoUnaryExpr goUnaryExpr ) {
239236 if (goUnaryExpr .getExpression () instanceof GoCompositeLit goCompositeLit ) {
240237 if (goCompositeLit .getTypeReferenceExpression () == null ) continue ;
241238 schema = goCompositeLit .getTypeReferenceExpression ().getIdentifier ().getText ();
242239 } else if (goUnaryExpr .getExpression () instanceof GoReferenceExpression goReferenceExpression ) {
243- GoVarDefinition goVarDefinition = (GoVarDefinition ) goReferenceExpression .resolve ();
244-
245- if (goVarDefinition == null ) continue ;
246-
247- GoType goType = goVarDefinition .getGoType (ResolveState .initial ());
248- if (goType == null || goType .getTypeReferenceExpression () == null ) continue ;
249-
250- schema = goType .getTypeReferenceExpression ().getIdentifier ().getText ();
240+ if (goReferenceExpression .resolve () instanceof GoVarDefinition goVarDefinition ) {
241+ GoType goType = goVarDefinition .getGoType (ResolveState .initial ());
242+ if (goType == null || goType .getTypeReferenceExpression () == null ) continue ;
243+
244+ schema = goType .getTypeReferenceExpression ().getIdentifier ().getText ();
245+ } else if (goReferenceExpression .resolve () instanceof GoParamDefinition goParamDefinition ) {
246+ GoPointerType goPointerType = PsiTreeUtil .findChildOfType (goParamDefinition .getParent (), GoPointerType .class );
247+ GoType goType = PsiTreeUtil .findChildOfType (goPointerType , GoType .class );
248+ if (goType != null ) {
249+ if (goType .getTypeReferenceExpression () == null ) continue ;
250+ schema = goType .getTypeReferenceExpression ().getIdentifier ().getText ();
251+ }
252+ }
251253 }
252254 } else if (argument instanceof GoBuiltinCallExpr goBuiltinCallExpr ) {
253255 GoType goType = PsiTreeUtil .findChildOfType (goBuiltinCallExpr , GoType .class );
0 commit comments