presto-main/src/main/java/io/prestosql/sql/analyzer/ScopeReferenceExtractor.java/ScopeReferenceExtractor/hasReferencesToScope
class ScopeReferenceExtractor:    public static boolean hasReferencesToScope(Node node, Analysis analysis, Scope scope)
    {
        return getReferencesToScope(node, analysis, scope).findAny().isPresent();
    }