Exemple #1
0
        public static bool ResolveExprNames(NameContext nc, ref Expr expr)
        {
            if (expr == null)
            {
                return(false);
            }
#if MAX_EXPR_DEPTH
            {
                Parse parse = nc.Parse;
                if (Expr.CheckHeight(parse, expr.Height + nc.Parse.Height) != 0)
                {
                    return(true);
                }
                parse.Height += expr.Height;
            }
#endif
            bool savedHasAgg = ((nc.NCFlags & NC.HasAgg) != 0);
            nc.NCFlags &= ~NC.HasAgg;
            Walker w = new Walker();
            w.ExprCallback   = ResolveExprStep;
            w.SelectCallback = ResolveSelectStep;
            w.Parse          = nc.Parse;
            w.u.NC           = nc;
            w.WalkExpr(expr);
#if MAX_EXPR_DEPTH
            nc.Parse.Height -= expr.Height;
#endif
            if (nc.Errs > 0 || w.Parse.Errs > 0)
            {
                E.ExprSetProperty(expr, EP.Error);
            }
            if ((nc.NCFlags & NC.HasAgg) != 0)
            {
                E.ExprSetProperty(expr, EP.Agg);
            }
            else if (savedHasAgg)
            {
                nc.NCFlags |= NC.HasAgg;
            }
            return(E.ExprHasProperty(expr, EP.Error));
        }