public QilLiteral LiteralInt64(long value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralInt64, value); n.XmlType = this.typeCheck.CheckLiteralInt64(n); TraceNode(n); return(n); }
public QilLiteral LiteralDouble(double value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralDouble, value); n.XmlType = this.typeCheck.CheckLiteralDouble(n); TraceNode(n); return(n); }
public QilLiteral LiteralInt32(int value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralInt32, value); n.XmlType = _typeCheck.CheckLiteralInt32(n); TraceNode(n); return(n); }
public QilLiteral LiteralString(string value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralString, value); n.XmlType = this.typeCheck.CheckLiteralString(n); TraceNode(n); return(n); }
public QilLiteral LiteralDecimal(decimal value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralDecimal, value); n.XmlType = this.typeCheck.CheckLiteralDecimal(n); TraceNode(n); return(n); }
public QilLiteral LiteralObject(object value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralObject, value); n.XmlType = this.typeCheck.CheckLiteralObject(n); TraceNode(n); return(n); }
public QilLiteral LiteralType(XmlQueryType value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralType, value); n.XmlType = this.typeCheck.CheckLiteralType(n); TraceNode(n); return(n); }
/// <summary> /// Generate code for QilNodeType.LiteralDouble. /// </summary> protected override QilNode VisitLiteralDouble(QilLiteral ndDbl) { _helper.Emit(OpCodes.Ldc_R8, (double)ndDbl); _iterCurr.Storage = StorageDescriptor.Stack(typeof(double), false); return ndDbl; }
public XmlQueryType CheckLiteralDouble(QilLiteral node) { CheckLiteralValue(node, typeof(double)); return XmlQueryTypeFactory.DoubleX; }
public XmlQueryType CheckLiteralInt32(QilLiteral node) { CheckLiteralValue(node, typeof(int)); return XmlQueryTypeFactory.IntX; }
protected virtual QilNode VisitLiteralObject(QilLiteral n) { return VisitChildren(n); }
public XmlQueryType CheckLiteralObject(QilLiteral node) { Check(node.Value != null, node, "Literal value is null"); return(XmlQueryTypeFactory.ItemS); }
public QilLiteral LiteralType(XmlQueryType value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralType, value); n.XmlType = this.typeCheck.CheckLiteralType(n); TraceNode(n); return n; }
public QilLiteral LiteralDecimal(decimal value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralDecimal, value); n.XmlType = this.typeCheck.CheckLiteralDecimal(n); TraceNode(n); return n; }
public QilLiteral LiteralDouble(double value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralDouble, value); n.XmlType = this.typeCheck.CheckLiteralDouble(n); TraceNode(n); return n; }
public QilLiteral LiteralInt64(long value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralInt64, value); n.XmlType = this.typeCheck.CheckLiteralInt64(n); TraceNode(n); return n; }
public QilLiteral LiteralString(string value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralString, value); n.XmlType = this.typeCheck.CheckLiteralString(n); TraceNode(n); return n; }
/// <summary> /// Generate code for QilNodeType.LiteralDecimal. /// </summary> protected override QilNode VisitLiteralDecimal(QilLiteral ndDec) { _helper.ConstructLiteralDecimal((decimal)ndDec); _iterCurr.Storage = StorageDescriptor.Stack(typeof(decimal), false); return ndDec; }
public XmlQueryType CheckLiteralInt64(QilLiteral node) { CheckLiteralValue(node, typeof(long)); return(XmlQueryTypeFactory.IntegerX); }
public XmlQueryType CheckLiteralDecimal(QilLiteral node) { CheckLiteralValue(node, typeof(decimal)); return(XmlQueryTypeFactory.DecimalX); }
public QilLiteral LiteralObject(object value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralObject, value); n.XmlType = this.typeCheck.CheckLiteralObject(n); TraceNode(n); return n; }
/// <summary> /// Generate code for QilNodeType.LiteralInt32. /// </summary> protected override QilNode VisitLiteralInt32(QilLiteral ndInt) { _helper.LoadInteger((int)ndInt); _iterCurr.Storage = StorageDescriptor.Stack(typeof(int), false); return ndInt; }
/// <summary> /// Return true if arithmetic operation "opType" can be computed over two literal operands without causing /// an overflow or divide by zero exception. /// </summary> private bool CanFoldArithmetic(QilNodeType opType, QilLiteral left, QilLiteral right) { return (FoldArithmetic(opType, left, right) is QilLiteral); }
/// <summary> /// Compute the arithmetic operation "opType" over two literal operands and return the result as a QilLiteral. /// Arithmetic operations are always checked; in the case of an overflow or divide by zero exception, return /// the unfolded result. /// </summary> private QilNode FoldArithmetic(QilNodeType opType, QilLiteral left, QilLiteral right) { Debug.Assert(left.NodeType == right.NodeType); // Catch any overflow or divide by zero exceptions try { checked { switch (left.NodeType) { case QilNodeType.LiteralInt32: { int intLeft = left; int intRight = right; switch (opType) { case QilNodeType.Add: return f.LiteralInt32(intLeft + intRight); case QilNodeType.Subtract: return f.LiteralInt32(intLeft - intRight); case QilNodeType.Multiply: return f.LiteralInt32(intLeft * intRight); case QilNodeType.Divide: return f.LiteralInt32(intLeft / intRight); case QilNodeType.Modulo: return f.LiteralInt32(intLeft % intRight); } break; } case QilNodeType.LiteralInt64: { long lngLeft = left; long lngRight = right; switch (opType) { case QilNodeType.Add: return f.LiteralInt64(lngLeft + lngRight); case QilNodeType.Subtract: return f.LiteralInt64(lngLeft - lngRight); case QilNodeType.Multiply: return f.LiteralInt64(lngLeft * lngRight); case QilNodeType.Divide: return f.LiteralInt64(lngLeft / lngRight); case QilNodeType.Modulo: return f.LiteralInt64(lngLeft % lngRight); } break; } case QilNodeType.LiteralDecimal: { decimal lngLeft = left; decimal lngRight = right; switch (opType) { case QilNodeType.Add: return f.LiteralDecimal(lngLeft + lngRight); case QilNodeType.Subtract: return f.LiteralDecimal(lngLeft - lngRight); case QilNodeType.Multiply: return f.LiteralDecimal(lngLeft * lngRight); case QilNodeType.Divide: return f.LiteralDecimal(lngLeft / lngRight); case QilNodeType.Modulo: return f.LiteralDecimal(lngLeft % lngRight); } break; } case QilNodeType.LiteralDouble: { double lngLeft = left; double lngRight = right; switch (opType) { case QilNodeType.Add: return f.LiteralDouble(lngLeft + lngRight); case QilNodeType.Subtract: return f.LiteralDouble(lngLeft - lngRight); case QilNodeType.Multiply: return f.LiteralDouble(lngLeft * lngRight); case QilNodeType.Divide: return f.LiteralDouble(lngLeft / lngRight); case QilNodeType.Modulo: return f.LiteralDouble(lngLeft % lngRight); } break; } } } } catch (OverflowException) { } catch (DivideByZeroException) { } // An error occurred, so don't fold operationo switch (opType) { case QilNodeType.Add: return f.Add(left, right); case QilNodeType.Subtract: return f.Subtract(left, right); case QilNodeType.Multiply: return f.Multiply(left, right); case QilNodeType.Divide: return f.Divide(left, right); case QilNodeType.Modulo: return f.Modulo(left, right); } Debug.Assert(false, "Cannot fold this arithmetic operation: " + opType); return null; }
protected override QilNode VisitLiteralDecimal(QilLiteral n) { return(NoReplace(n)); }
protected virtual QilNode VisitLiteralDecimal(QilLiteral n) { return VisitChildren(n); }
protected override QilNode VisitLiteralObject(QilLiteral n) { return(NoReplace(n)); }
public XmlQueryType CheckLiteralString(QilLiteral node) { CheckLiteralValue(node, typeof(string)); return XmlQueryTypeFactory.StringX; }
public XmlQueryType CheckLiteralType(QilLiteral node) { CheckLiteralValue(node, typeof(XmlQueryType)); return (XmlQueryType) node; }
public XmlQueryType CheckLiteralInt64(QilLiteral node) { CheckLiteralValue(node, typeof(long)); return XmlQueryTypeFactory.IntegerX; }
public XmlQueryType CheckLiteralString(QilLiteral node) { CheckLiteralValue(node, typeof(string)); return(XmlQueryTypeFactory.StringX); }
public XmlQueryType CheckLiteralDecimal(QilLiteral node) { CheckLiteralValue(node, typeof(decimal)); return XmlQueryTypeFactory.DecimalX; }
/// <summary> /// Generate code for QilNodeType.LiteralInt64. /// </summary> protected override QilNode VisitLiteralInt64(QilLiteral ndLong) { _helper.Emit(OpCodes.Ldc_I8, (long)ndLong); _iterCurr.Storage = StorageDescriptor.Stack(typeof(long), false); return ndLong; }
public XmlQueryType CheckLiteralObject(QilLiteral node) { Check(node.Value != null, node, "Literal value is null"); return XmlQueryTypeFactory.ItemS; }
protected override QilNode VisitLiteralDecimal(QilLiteral n) { return NoReplace(n); }
public XmlQueryType CheckLiteralInt32(QilLiteral node) { CheckLiteralValue(node, typeof(int)); return(XmlQueryTypeFactory.IntX); }
protected override QilNode VisitLiteralObject(QilLiteral n) { return NoReplace(n); }
public XmlQueryType CheckLiteralDouble(QilLiteral node) { CheckLiteralValue(node, typeof(double)); return(XmlQueryTypeFactory.DoubleX); }
protected virtual QilNode VisitLiteralDecimal(QilLiteral n) { return(VisitChildren(n)); }
public XmlQueryType CheckLiteralType(QilLiteral node) { CheckLiteralValue(node, typeof(XmlQueryType)); return((XmlQueryType)node); }
public QilLiteral LiteralInt32(int value) { QilLiteral n = new QilLiteral(QilNodeType.LiteralInt32, value); n.XmlType = _typeCheck.CheckLiteralInt32(n); TraceNode(n); return n; }
/// <summary> /// Serialize literal types using either "S" or "G" formatting, depending on the option which has been set. /// </summary> protected override QilNode VisitLiteralType(QilLiteral value) { this.writer.WriteString(((XmlQueryType)value).ToString((this.options & Options.TypeInfo) != 0 ? "G" : "S")); return(value); }
/// <summary> /// Generate code for QilNodeType.LiteralString. /// </summary> protected override QilNode VisitLiteralString(QilLiteral ndStr) { _helper.Emit(OpCodes.Ldstr, (string)ndStr); _iterCurr.Storage = StorageDescriptor.Stack(typeof(string), false); return ndStr; }
protected virtual QilNode VisitLiteralObject(QilLiteral n) { return(VisitChildren(n)); }
protected override QilNode VisitLiteralType(QilLiteral n) { return NoReplace(n); }