public static bool ReferencesRootVariable(Expr expr)
        {
            var visitor = new ReferencesRootVariableVisitor();

            expr.Accept(visitor);
            return(visitor._referencesRootVariable);
        }
Ejemplo n.º 2
0
        public override void Visit(ChainExpr expr)
        {
            if (ReferencesRootVariableVisitor.ReferencesRootVariable(expr))
            {
                _needsAsync = true;
                return;
            }

            // Some things can't be simplified by themselves, but they can be in the
            // context of a chain. If this chain doesn't need to be asynchronous, then
            // the next key or index won't need it either.
            if (NeedsAsyncByItselfVisitor.NeedsAsyncByItself(expr.Next))
            {
                _needsAsync = true;
                return;
            }
        }