internal override ExpressionNode Optimize() { for (int i = 0; i < _argumentCount; i++) { _arguments[i] = _arguments[i].Optimize(); } Debug.Assert(_info > -1, "Optimizing unbound function "); // default info is -1, it means if not bounded, it should be -1, not 0!! if (s_funcs[_info]._id == FunctionId.In) { // we can not optimize the in node, just check that it has all constant arguments if (!IsConstant()) { throw ExprException.NonConstantArgument(); } } else { if (IsConstant()) { return(new ConstNode(table, ValueType.Object, Eval(), false)); } } return(this); }
internal override ExpressionNode Optimize() { for (int i = 0; i < this.argumentCount; i++) { this.arguments[i] = this.arguments[i].Optimize(); } Debug.Assert(this.info > 0, "Optimizing unbound function "); if (funcs[this.info].id == FunctionId.In) { // we can not optimize the in node, just check that it has all constant arguments // CONSIDER : can not find better place for this.. check that the IN arguments are all constants if (!this.IsConstant()) { throw ExprException.NonConstantArgument(); } } else { if (this.IsConstant()) { #if DEBUG if (CompModSwitches.FunctionNode.TraceVerbose) { Debug.WriteLine("CONSTANT function node " + this.ToString()); } #endif return(new ConstNode(ValueType.Object, this.Eval(), false)); } #if DEBUG else { if (CompModSwitches.FunctionNode.TraceVerbose) { Debug.WriteLine("Can not optimize the function call"); } } #endif } return(this); }
internal override ExpressionNode Optimize() { for (int i = 0; i < this.argumentCount; i++) { this.arguments[i] = this.arguments[i].Optimize(); } if (funcs[this.info].id == FunctionId.In) { if (!this.IsConstant()) { throw ExprException.NonConstantArgument(); } } else if (this.IsConstant()) { return(new ConstNode(base.table, System.Data.ValueType.Object, this.Eval(), false)); } return(this); }