void (final @NotNull PyGlobalStatement node) { PyFunction function = PsiTreeUtil.getParentOfType(node, PyFunction.class); if (function != null) { PyParameterList paramList = function.getParameterList(); // collect param names final Set<String> paramNames = new HashSet<>(); ParamHelper.walkDownParamArray( paramList.getParameters(), new ParamHelper.ParamVisitor() { @Override public void visitNamedParameter(PyNamedParameter param, boolean first, boolean last) { paramNames.add(param.getName()); } } ); // check globals final AnnotationHolder holder = getHolder(); for (PyTargetExpression expr : node.getGlobals()) { final String expr_name = expr.getReferencedName(); if (paramNames.contains(expr_name)) { holder.newAnnotation(HighlightSeverity.ERROR, PyPsiBundle.message("ANN.name.used.both.as.global.and.param", expr_name)).range(expr).create(); } } } }