2004-02-07 Tim Coleman <tim@timcoleman.com>
[mono.git] / mcs / mbas / constant.cs
index 2bfdfc031f5a8f6eb889daeffcb7a677dbca3ffa..f3fa00745c3d9d48a5861f90c1f5d35d547d0886 100644 (file)
@@ -8,7 +8,7 @@
 //
 //
 
-namespace Mono.CSharp {
+namespace Mono.MonoBASIC {
 
        using System;
        using System.Reflection.Emit;
@@ -680,7 +680,12 @@ namespace Mono.CSharp {
 
                static public void EmitLong (ILGenerator ig, long l)
                {
-                       ig.Emit (OpCodes.Ldc_I8, l);
+                       if ((l >> 32) == 0){
+                               IntLiteral.EmitInt (ig, unchecked ((int) l));
+                               ig.Emit (OpCodes.Conv_U8);
+                       } else {
+                               ig.Emit (OpCodes.Ldc_I8, l);
+                       }
                }
 
                public override string AsString ()
@@ -964,6 +969,31 @@ namespace Mono.CSharp {
                }
        }
 
-}
+       public class DateConstant : Constant {
+               public readonly DateTime Value;
 
+               public DateConstant (DateTime s)
+               {
+                       type = TypeManager.date_type;
+                       eclass = ExprClass.Value;
+                       Value = s;
+               }
 
+               override public string AsString ()
+               {
+                       return "#" + Value.ToString() + "#";
+               }
+
+               public override object GetValue ()
+               {
+                       return Value;
+               }
+               
+               public override void Emit (EmitContext ec)
+               {
+                       ec.ig.Emit (OpCodes.Ldc_I8, Value.Ticks);
+                       ec.ig.Emit (OpCodes.Newobj, TypeManager.void_datetime_ctor_ticks_arg);
+               }
+       }
+
+}