boolean (@Nullable GrExpression expr) { if (expr == null) return false; while (expr instanceof GrReferenceExpression) { final PsiElement nameElement = ((GrReferenceExpression)expr).getReferenceNameElement(); if (((GrReferenceExpression)expr).getTypeArguments().length > 0) return false; if (nameElement == null || !TokenSets.CODE_REFERENCE_ELEMENT_NAME_TOKENS.contains(nameElement.getNode().getElementType())) { return false; } IElementType dotType = ((GrReferenceExpression)expr).getDotTokenType(); if (dotType != null && dotType != GroovyTokenTypes.mDOT) return false; expr = ((GrReferenceExpression)expr).getQualifierExpression(); } return expr == null; }