2005-01-19 Sureshkumar T <tsureshkumar@novell.com>
[mono.git] / mcs / mbas / constant.cs
index f31cb733ae1f8fe0c95c06016238e1a64c261969..f3fa00745c3d9d48a5861f90c1f5d35d547d0886 100644 (file)
@@ -969,4 +969,31 @@ namespace Mono.MonoBASIC {
                }
        }
 
+       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);
+               }
+       }
+
 }