Beispiel #1
0
 public UnifiedElement VisitPrimitiveExpression(
     PrimitiveExpression prim, object data)
 {
     if (prim.Value == null)
     {
         return(UnifiedNullLiteral.Create());
     }
     if (prim.Value is bool)
     {
         return(UnifiedBooleanLiteral.Create((bool)prim.Value));
     }
     if (prim.Value is Int32)
     {
         return(UnifiedIntegerLiteral.CreateInt32((Int32)prim.Value));
     }
     if (prim.Value is UInt32)
     {
         return(UnifiedIntegerLiteral.CreateUInt32((UInt32)prim.Value));
     }
     if (prim.Value is Int64)
     {
         return(UnifiedIntegerLiteral.CreateInt64((Int64)prim.Value));
     }
     if (prim.Value is UInt64)
     {
         return(UnifiedIntegerLiteral.CreateUInt64((UInt64)prim.Value));
     }
     if (prim.Value is Single)
     {
         return(UnifiedFractionLiteral.Create(
                    (Single)prim.Value, UnifiedFractionLiteralKind.Single));
     }
     if (prim.Value is double)
     {
         return(UnifiedFractionLiteral.Create(
                    (double)prim.Value, UnifiedFractionLiteralKind.Double));
     }
     if (prim.Value is char)
     {
         return(UnifiedCharLiteral.Create(((char)prim.Value).ToString()));
     }
     if (prim.Value is string)
     {
         return(UnifiedStringLiteral.Create(prim.LiteralValue));
     }
     throw new NotImplementedException(
               "value type is " + prim.Value.GetType());
 }
 public override bool Visit(
         UnifiedNullLiteral element, VisitorArgument arg)
 {
     Writer.Write("null");
     return false;
 }
Beispiel #3
0
 public UnifiedElement VisitNullReferenceExpression(
     NullReferenceExpression expr, object data)
 {
     return(UnifiedNullLiteral.Create());
 }
 public override bool Visit(
     UnifiedNullLiteral element, VisitorArgument arg)
 {
     Writer.Write("null");
     return(false);
 }