GrParameter (final PsiElement element) { if (element instanceof GrParameter) { return (GrParameter)element; } if (element instanceof GrReferenceExpression expr) { final PsiElement resolved = expr.resolve(); LOG.assertTrue(resolved instanceof GrParameter); return ((GrParameter)resolved); } LOG.error("Selected expression is not resolved to method/closure parameter"); return null; }