コード例 #1
0
 // Derived classes that need a context to be evaluated
 // must override this method to return a new expression that has the simplified versions of their children.
 protected virtual Expr SimplifyChildren(VariableScope scope)
 {
     if (NeedsAsyncVisitor.NeedsAsync(this, scope))
     {
         throw new NotImplementedException("Must implement SimplifyChildren");
     }
     else
     {
         return(this);
     }
 }
コード例 #2
0
        public virtual Expr Simplify(VariableScope scope)
        {
            if (IsConstant)
            {
                return(this);
            }

            if (NeedsAsyncVisitor.NeedsAsync(this, scope))
            {
                return(SimplifyChildren(scope));
            }
            else
            {
                // Since this thing can be simplified in real time, lk
                return(new LiteralExpr(Location, this.Apply(new QueryContext(AsyncNull.Instance, scope)).Result));
            }
        }