static void visitReferencedElements(PsiReference[] references, NullableConsumer<? super PsiElement> consumer) {
    for (PsiReference reference : references) {
      if (reference instanceof PsiPolyVariantReference) {
        final ResolveResult[] resolveResults = ((PsiPolyVariantReference)reference).multiResolve(false);
        for (ResolveResult resolveResult : resolveResults) {
          consumer.consume(resolveResult.getElement());
        }
      }
      else {
        consumer.consume(reference.resolve());
      }
    }
  }
static void visitReferencedElements(PsiReference[] references, NullableConsumer<? super PsiElement> consumer)