Ooops.
[mono.git] / mcs / mbas / literal.cs
index 2250dd12bf3551e4c00c4914fbaea52b3562cf89..2aec7d3588df966f95fce90f61e2c0fdaf1cce1e 100644 (file)
-//\r
-// literal.cs: Literal representation for the IL tree.\r
-//\r
-// Author:\r
-//   Miguel de Icaza (miguel@ximian.com)\r
-//\r
-// (C) 2001 Ximian, Inc.\r
-//\r
-//\r
-// Notice that during parsing we create objects of type Literal, but the\r
-// types are not loaded (thats why the Resolve method has to assign the\r
-// type at that point).\r
-//\r
-// Literals differ from the constants in that we know we encountered them\r
-// as a literal in the source code (and some extra rules apply there) and\r
-// they have to be resolved (since during parsing we have not loaded the\r
-// types yet) while constants are created only after types have been loaded\r
-// and are fully resolved when born.\r
-//\r
-\r
-using System;\r
-using System.Reflection;\r
-using System.Reflection.Emit;\r
-\r
-namespace Mono.CSharp {\r
-\r
-       public class NullLiteral : Constant {\r
-               public static readonly NullLiteral Null;\r
-               \r
-               static NullLiteral ()\r
-               {\r
-                       Null = new NullLiteral ();\r
-               }\r
-                       \r
-               public NullLiteral ()\r
-               {\r
-                       if (Null != null)\r
-                               throw new Exception ("More than one null has been created!");\r
-                       eclass = ExprClass.Value;\r
-               }\r
-               \r
-               override public string AsString ()\r
-               {\r
-                       return "null";\r
-               }\r
-\r
-               public override object GetValue ()\r
-               {\r
-                       return null;\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.object_type;\r
-                       return this;\r
-               }\r
-\r
-               public override void Emit (EmitContext ec)\r
-               {\r
-                       ec.ig.Emit (OpCodes.Ldnull);\r
-               }\r
-       }\r
-\r
-       public class BoolLiteral : BoolConstant {\r
-               public BoolLiteral (bool val) : base (val)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.bool_type;\r
-                       return this;\r
-               }\r
-       }\r
-\r
-       public class CharLiteral : CharConstant {\r
-               public CharLiteral (char c) : base (c)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.char_type;\r
-                       return this;\r
-               }\r
-       }\r
-\r
-       public class IntLiteral : IntConstant {\r
-               public IntLiteral (int l) : base (l)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.int32_type;\r
-                       return this;\r
-               }\r
-       }\r
-\r
-       public class UIntLiteral : UIntConstant {\r
-               public UIntLiteral (uint l) : base (l)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.uint32_type;\r
-                       return this;\r
-               }\r
-       }\r
-       \r
-       public class LongLiteral : LongConstant {\r
-               public LongLiteral (long l) : base (l)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.int64_type;\r
-\r
-                       return this;\r
-               }\r
-       }\r
-\r
-       public class ULongLiteral : ULongConstant {\r
-               public ULongLiteral (ulong l) : base (l)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.uint64_type;\r
-                       return this;\r
-               }\r
-       }\r
-       \r
-       public class FloatLiteral : FloatConstant {\r
-               \r
-               public FloatLiteral (float f) : base (f)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.float_type;\r
-                       return this;\r
-               }\r
-       }\r
-\r
-       public class DoubleLiteral : DoubleConstant {\r
-               public DoubleLiteral (double d) : base (d)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.double_type;\r
-\r
-                       return this;\r
-               }\r
-       }\r
-\r
-       public class DecimalLiteral : DecimalConstant {\r
-               public DecimalLiteral (decimal d) : base (d)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.decimal_type;\r
-                       return this;\r
-               }\r
-\r
-               public override void Emit (EmitContext ec)\r
-               {\r
-                       throw new Exception ("Implement me");\r
-               }\r
-       }\r
-\r
-       public class StringLiteral : StringConstant {\r
-               public StringLiteral (string s) : base (s)\r
-               {\r
-               }\r
-\r
-               public override Expression DoResolve (EmitContext ec)\r
-               {\r
-                       type = TypeManager.string_type;\r
-\r
-                       return this;\r
-               }\r
-       }\r
-}\r
+//
+// literal.cs: Literal representation for the IL tree.
+//
+// Author:
+//   Miguel de Icaza (miguel@ximian.com)
+//
+// (C) 2001 Ximian, Inc.
+//
+//
+// Notice that during parsing we create objects of type Literal, but the
+// types are not loaded (thats why the Resolve method has to assign the
+// type at that point).
+//
+// Literals differ from the constants in that we know we encountered them
+// as a literal in the source code (and some extra rules apply there) and
+// they have to be resolved (since during parsing we have not loaded the
+// types yet) while constants are created only after types have been loaded
+// and are fully resolved when born.
+//
+
+using System;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace Mono.MonoBASIC {
+
+       public class NullLiteral : Constant {
+               public static readonly NullLiteral Null;
+               
+               static NullLiteral ()
+               {
+                       Null = new NullLiteral ();
+               }
+                       
+               public NullLiteral ()
+               {
+                       if (Null != null)
+                               throw new Exception ("More than one null has been created!");
+                       eclass = ExprClass.Value;
+               }
+               
+               override public string AsString ()
+               {
+                       return "null";
+               }
+
+               public override object GetValue ()
+               {
+                       return null;
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.object_type;
+                       return this;
+               }
+
+               public override void Emit (EmitContext ec)
+               {
+                       ec.ig.Emit (OpCodes.Ldnull);
+               }
+       }
+
+       public class BoolLiteral : BoolConstant {
+               public BoolLiteral (bool val) : base (val)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.bool_type;
+                       return this;
+               }
+       }
+
+       public class CharLiteral : CharConstant {
+               public CharLiteral (char c) : base (c)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.char_type;
+                       return this;
+               }
+       }
+
+       public class IntLiteral : IntConstant {
+               public IntLiteral (int l) : base (l)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.int32_type;
+                       return this;
+               }
+       }
+
+       public class ShortLiteral : ShortConstant {
+               public ShortLiteral (short l) : base (l)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.short_type;
+                       return this;
+               }
+       }
+
+       public class UIntLiteral : UIntConstant {
+               public UIntLiteral (uint l) : base (l)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.uint32_type;
+                       return this;
+               }
+       }
+       
+       public class LongLiteral : LongConstant {
+               public LongLiteral (long l) : base (l)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.int64_type;
+
+                       return this;
+               }
+       }
+
+       public class ULongLiteral : ULongConstant {
+               public ULongLiteral (ulong l) : base (l)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.uint64_type;
+                       return this;
+               }
+       }
+       
+       public class FloatLiteral : FloatConstant {
+               
+               public FloatLiteral (float f) : base (f)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.float_type;
+                       return this;
+               }
+       }
+
+       public class DoubleLiteral : DoubleConstant {
+               public DoubleLiteral (double d) : base (d)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.double_type;
+
+                       return this;
+               }
+       }
+
+       public class DecimalLiteral : DecimalConstant {
+               public DecimalLiteral (decimal d) : base (d)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.decimal_type;
+                       return this;
+               }
+       }
+
+       public class StringLiteral : StringConstant {
+               public StringLiteral (string s) : base (s)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.string_type;
+
+                       return this;
+               }
+       }
+       
+       public class DateLiteral : DateConstant {
+               public DateLiteral (DateTime s) : base (s)
+               {
+               }
+
+               public override Expression DoResolve (EmitContext ec)
+               {
+                       type = TypeManager.date_type;
+
+                       return this;
+               }
+       }
+}