Author: martin
Date: 2005-04-12 08:10:05 -0400 (Tue, 12 Apr 2005)
New Revision: 42828

Modified:
   trunk/mcs/gmcs/ChangeLog
   trunk/mcs/gmcs/expression.cs
Log:
**** Merged r40612 from MCS ****


Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog    2005-04-12 12:09:43 UTC (rev 42827)
+++ trunk/mcs/gmcs/ChangeLog    2005-04-12 12:10:05 UTC (rev 42828)
@@ -1,3 +1,17 @@
+2005-02-14  Marek Safar  <[EMAIL PROTECTED]>
+
+       * expression.cs (New.DoResolve): Add complex core type reduction.
+       (New.Constantify): Converts complex core type syntax like 'new int ()'
+       to simple constant.
+       
+2005-02-14  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * decl.cs (EntryType.EntryType): New constructor to create an
+       updated copy of a cache entry.
+       (MemberCache.AddMethods): Use it.
+       (MemberCache.ClearDeclaredOnly): Remove.
+       (MemberCache.MemberCache): Update.
+
 2005-02-11  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * codegen.cs (EmitContext): Introduce the `MethodIsStatic'

Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs        2005-04-12 12:09:43 UTC (rev 42827)
+++ trunk/mcs/gmcs/expression.cs        2005-04-12 12:10:05 UTC (rev 42828)
@@ -5842,6 +5842,42 @@
 //                     value_target = MyEmptyExpression;
                }
 
+
+               /// <summary>
+               /// Converts complex core type syntax like 'new int ()' to 
simple constant
+               /// </summary>
+               Expression Constantify (Type t)
+               {
+                       if (t == TypeManager.int32_type)
+                               return new IntConstant (0);
+                       if (t == TypeManager.uint32_type)
+                               return new UIntConstant (0);
+                       if (t == TypeManager.int64_type)
+                               return new LongConstant (0);
+                       if (t == TypeManager.uint64_type)
+                               return new ULongConstant (0);
+                       if (t == TypeManager.float_type)
+                               return new FloatConstant (0);
+                       if (t == TypeManager.double_type)
+                               return new DoubleConstant (0);
+                       if (t == TypeManager.short_type)
+                               return new ShortConstant (0);
+                       if (t == TypeManager.ushort_type)
+                               return new UShortConstant (0);
+                       if (t == TypeManager.sbyte_type)
+                               return new SByteConstant (0);
+                       if (t == TypeManager.byte_type)
+                               return new ByteConstant (0);
+                       if (t == TypeManager.char_type)
+                               return new CharConstant ('\0');
+                       if (t == TypeManager.bool_type)
+                               return new BoolConstant (false);
+                       if (t == TypeManager.decimal_type)
+                               return new DecimalConstant (0);
+
+                       return null;
+               }
+
                public override Expression DoResolve (EmitContext ec)
                {
                        //
@@ -5861,6 +5897,12 @@
                        TypeExpr texpr = RequestedType.ResolveAsTypeTerminal 
(ec);
                        if (texpr == null)
                                return null;
+
+                       if (Arguments == null) {
+                               Expression c = Constantify (type);
+                               if (c != null)
+                                       return c;
+                       }
                        
                        type = texpr.Type;
                        if (type == null)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to