internal XPathConjunctExpr(XPathExprType type, ValueDataType returnType, XPathExpr left, XPathExpr right) : base(type, returnType) { if ((left == null) || (right == null)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.InvalidExpression)); } base.SubExpr.Add(left); base.SubExpr.Add(right); }
private void CompileStringLiteralEquality(XPathRelationExpr expr) { bool flag = XPathExprType.String == expr.Left.Type; XPathExprType type = expr.Right.Type; this.CompileExpression(flag ? expr.Right : expr.Left); string literal = flag ? ((XPathStringExpr)expr.Left).String : ((XPathStringExpr)expr.Right).String; this.codeBlock.Append(new StringEqualsOpcode(literal)); }
private void CompileNumberRelation(XPathRelationExpr expr) { if (expr.Op == RelationOperator.Eq) { this.CompileNumberLiteralEquality(expr); } else { bool flag = XPathExprType.Number == expr.Left.Type; XPathExprType type = expr.Right.Type; this.CompileExpression(flag ? expr.Right : expr.Left); XPathNumberExpr expr2 = flag ? ((XPathNumberExpr)expr.Left) : ((XPathNumberExpr)expr.Right); double number = expr2.Number; if (expr2.Negate) { expr2.Negate = false; number = -number; } if (flag) { switch (expr.Op) { case RelationOperator.Gt: expr.Op = RelationOperator.Lt; break; case RelationOperator.Ge: expr.Op = RelationOperator.Le; break; case RelationOperator.Lt: expr.Op = RelationOperator.Gt; break; case RelationOperator.Le: expr.Op = RelationOperator.Ge; break; } } if ((this.compiler.flags & QueryCompilerFlags.InverseQuery) != QueryCompilerFlags.None) { this.codeBlock.Append(new NumberIntervalOpcode(number, expr.Op)); } else { this.codeBlock.Append(new NumberRelationOpcode(number, expr.Op)); } } }
internal void AddBooleanExpression(XPathExprType boolExprType, XPathExpr expr) { if (boolExprType == expr.Type) { XPathExprList subExpr = expr.SubExpr; for (int i = 0; i < subExpr.Count; i++) { this.AddBooleanExpression(boolExprType, subExpr[i]); } } else { this.Add(expr); } }
private void CompileNumberLiteralEquality(XPathRelationExpr expr) { bool flag = XPathExprType.Number == expr.Left.Type; XPathExprType type = expr.Right.Type; this.CompileExpression(flag ? expr.Right : expr.Left); XPathNumberExpr expr2 = flag ? ((XPathNumberExpr)expr.Left) : ((XPathNumberExpr)expr.Right); double number = expr2.Number; if (expr2.Negate) { expr2.Negate = false; number = -number; } this.codeBlock.Append(new NumberEqualsOpcode(number)); }
internal void AddBooleanExpression(XPathExprType boolExprType, XPathExpr expr) { Fx.Assert(boolExprType == this.type, ""); // An boolean sub0expression that is of the same type as its container should be merged and flattened // into its parent if (boolExprType == expr.Type) { XPathExprList subExprList = expr.SubExpr; for (int i = 0; i < subExprList.Count; ++i) { this.AddBooleanExpression(boolExprType, subExprList[i]); } } else { this.Add(expr); } }
internal XPathLiteralExpr(XPathExprType type, ValueDataType returnType) : base(type, returnType) { }
internal XPathExpr(XPathExprType type, ValueDataType returnType, XPathExprList subExpr) : this(type, returnType) { this.subExpr = subExpr; }
internal XPathExpr(XPathExprType type, ValueDataType returnType) { this.type = type; this.returnType = returnType; }