2004-04-07 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Wed, 7 Apr 2004 05:36:16 +0000 (05:36 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Wed, 7 Apr 2004 05:36:16 +0000 (05:36 -0000)
* typemanager.cs: Add new types to lookup: System.TypedReference
and ArgIterator.

* paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
check for TypedReference or ArgIterator, they are not allowed.

* ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
makes us properly catch 1510 in some conditions (see bug 56016 for
details).

svn path=/trunk/mcs/; revision=25136

mcs/mcs/ChangeLog
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/parameter.cs
mcs/mcs/typemanager.cs

index 307848cca678bb5bd2125f1e7c2c8a2901511083..ce161d22346ae7c10b38d9fc9910e916dd62da05 100755 (executable)
@@ -1,3 +1,15 @@
+2004-04-07  Miguel de Icaza  <miguel@ximian.com>
+
+       * typemanager.cs: Add new types to lookup: System.TypedReference
+       and ArgIterator.
+
+       * paramter.cs (Parameter.Resolve): if we are an out/ref parameter,
+       check for TypedReference or ArgIterator, they are not allowed. 
+
+       * ecore.cs (BoxedCast): Set the eclass to ExprClass.Value, this
+       makes us properly catch 1510 in some conditions (see bug 56016 for
+       details). 
+
 2004-04-06  Bernie Solomon  <bernard@ugsolutions.com>
 
        * CryptoConvert.cs: update from corlib version
index 6c7a2eac7d240aefd3a257a0f6d7f030956dd2b3..8d78476c97c531026c0de50dfb0a1ee523aa5da7 100755 (executable)
@@ -1532,11 +1532,13 @@ namespace Mono.CSharp {
                public BoxedCast (Expression expr)
                        : base (expr, TypeManager.object_type) 
                {
+                       eclass = ExprClass.Value;
                }
 
                public BoxedCast (Expression expr, Type target_type)
                        : base (expr, target_type)
                {
+                       eclass = ExprClass.Value;
                }
                
                public override Expression DoResolve (EmitContext ec)
index 06fff718a381f2fa058c1a9ee8692aae8fe60e83..204eae9bd09a2cd47005c7ad4ad2c57bb0d47bea 100755 (executable)
@@ -4039,8 +4039,9 @@ namespace Mono.CSharp {
                                                
                                                pr.AddressOf (ec, mode);
                                        }
-                               } else
+                               } else {
                                        ((IMemoryLocation)Expr).AddressOf (ec, mode);
+                               }
                        } else
                                Expr.Emit (ec);
                }
index 5e1e641ded2bcd08c65592bc9208289a0572fe94..76ccb1d3d0ae6fde0a544670d1c4db515417046d 100755 (executable)
@@ -57,6 +57,15 @@ namespace Mono.CSharp {
                                return false;
                        }
 
+                       if ((ModFlags & Parameter.Modifier.ISBYREF) != 0){
+                               if (parameter_type == TypeManager.typed_reference_type ||
+                                   parameter_type == TypeManager.arg_iterator_type){
+                                       Report.Error (1601, l,
+                                                     "out or ref parameter can not be of type TypedReference or ArgIterator");
+                                       return false;
+                               }
+                       }
+                       
                        return parameter_type != null;
                }
 
index 1839450c58df7c363eae24754e59b36e64e1e387..067fe0ad5e0b931a016bceb1adfa382c3c0f8e97 100755 (executable)
@@ -85,6 +85,8 @@ public class TypeManager {
        static public object conditional_attribute_type;
        static public Type in_attribute_type;
        static public Type cls_compliant_attribute_type;
+       static public Type typed_reference_type;
+       static public Type arg_iterator_type;
 
        //
        // An empty array of types
@@ -1039,6 +1041,8 @@ public class TypeManager {
                marshal_as_attr_type = CoreLookupType ("System.Runtime.InteropServices.MarshalAsAttribute");
                param_array_type     = CoreLookupType ("System.ParamArrayAttribute");
                in_attribute_type    = CoreLookupType ("System.Runtime.InteropServices.InAttribute");
+               typed_reference_type = CoreLookupType ("System.TypedReference");
+               arg_iterator_type    = CoreLookupType ("System.ArgIterator");
 
                //
                // Sigh. Remove this before the release.  Wonder what versions of Mono