Beispiel #1
0
 public ExprCastNodeConstEval(
     ExprCastNode parent,
     object theConstant)
 {
     this.parent = parent;
     this.theConstant = theConstant;
 }
 public ExprCastNodeNonConstEval(
     ExprCastNode parent,
     ExprEvaluator evaluator,
     ExprCastNode.CasterParserComputer casterParserComputer)
 {
     this.parent = parent;
     this.evaluator = evaluator;
     this.casterParserComputer = casterParserComputer;
 }
Beispiel #3
0
        public void SetUp()
        {
            castNodes = new ExprCastNode[2];

            castNodes[0] = new ExprCastNode(new ClassIdentifierWArray("long"));
            castNodes[0].AddChildNode(new SupportExprNode(10L, typeof(long?)));

            castNodes[1] = new ExprCastNode(new ClassIdentifierWArray(typeof(int).FullName));
            castNodes[1].AddChildNode(new SupportExprNode(0x10, typeof(byte)));
        }
Beispiel #4
0
 /// <summary>
 ///     NOTE: Code-generation-invoked method, method name and parameter order matters
 /// </summary>
 /// <param name="format">format</param>
 /// <param name="input">input</param>
 /// <returns>msec</returns>
 public static long StringToLongWStaticFormatParseSafe(
     DateFormat format,
     object input)
 {
     try {
         return(format.Parse(input.ToString()).UtcMillis);
     }
     catch (ParseException e) {
         throw ExprCastNode.HandleParseException(format, input.ToString(), e);
     }
 }
Beispiel #5
0
 /// <summary>
 ///     NOTE: Code-generation-invoked method, method name and parameter order matters
 /// </summary>
 /// <param name="format">format</param>
 /// <param name="input">input</param>
 /// <param name="timeZone">time zone</param>
 /// <returns>dtx</returns>
 public static DateTimeEx StringToDtxWStaticFormatParse(
     DateFormat format,
     object input,
     TimeZoneInfo timeZone)
 {
     try {
         return(DateTimeEx.GetInstance(timeZone, format.Parse(input.ToString())));
     }
     catch (ParseException ex) {
         throw ExprCastNode.HandleParseException(format, input.ToString(), ex);
     }
 }
Beispiel #6
0
 internal ExprCastNodeForge(
     ExprCastNode parent,
     ExprCastNode.CasterParserComputerForge casterParserComputerForge,
     Type targetType,
     bool isConstant,
     object constant)
 {
     ForgeRenderableCast = parent;
     CasterParserComputerForge = casterParserComputerForge;
     EvaluationType = targetType;
     IsConstant = isConstant;
     Constant = constant;
 }
Beispiel #7
0
        public void TestValidate()
        {
            var castNode = new ExprCastNode(new ClassIdentifierWArray("int"));

            // Test too few nodes under this node
            try
            {
                castNode.Validate(SupportExprValidationContextFactory.MakeEmpty(container));
                Assert.Fail();
            }
            catch (ExprValidationException)
            {
                // Expected
            }
        }