2008-07-18 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Fri, 18 Jul 2008 21:28:29 +0000 (21:28 -0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 18 Jul 2008 21:28:29 +0000 (21:28 -0000)
* ecore.cs, linq.cs, delegate.cs, constant.cs, nullable.cs, expression.cs:
Finished missing generic type mutators.

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

mcs/mcs/ChangeLog
mcs/mcs/constant.cs
mcs/mcs/delegate.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/linq.cs
mcs/mcs/nullable.cs

index 4638a39c7e0aa7f19916046c89e9335d903515a7..022ac8306c4b7afa30c4f9d8e2fdfebd63ad464b 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-18  Marek Safar  <marek.safar@gmail.com>
+
+       * ecore.cs, linq.cs, delegate.cs, constant.cs, nullable.cs, expression.cs:
+       Finished missing generic type mutators.
+
 2008-07-18  Marek Safar  <marek.safar@gmail.com>
 
        * iterators.cs, statement.cs: Finished statements CloneTo.
index d9f1b58e8df940af1ce6cd2ada0e1666d32078f8..fd49c045db8d9f88f33d65b8f886e9a985588cc8 100644 (file)
@@ -254,6 +254,11 @@ namespace Mono.CSharp {
                {
                        // CloneTo: Nothing, we do not keep any state on this expression
                }
+
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       // A constant cannot be of generic type
+               }
        }
 
        public abstract class IntegralConstant : Constant {
index fdc1669ba0a5a2aaf463ee5b3d3318db326cefb2..bf35776da5ac0312f4089f47b7cc8bd3e8859855 100644 (file)
@@ -814,6 +814,15 @@ namespace Mono.CSharp {
                        return null;
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       if (delegate_instance_expression != null)
+                               delegate_instance_expression.MutateHoistedGenericType (storey);
+
+                       delegate_method = storey.MutateGenericMethod (delegate_method);
+                       constructor_method = storey.MutateConstructor (constructor_method);
+               }
+
                #region IErrorHandler Members
 
                public bool NoExactMatch (EmitContext ec, MethodBase method)
index 53a174cbbab12abc3f689323ed5aa93af7ded81c..2d8e3dd7e1b70b0226a9dfd235cc939933b7e8e0 100644 (file)
@@ -2220,6 +2220,11 @@ namespace Mono.CSharp {
                                }
                        }
 
+                       public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+                       {
+                               expr.MutateHoistedGenericType (storey);
+                       }
+
                        public override void Emit (EmitContext ec)
                        {
                                expr.Emit (ec);
@@ -2270,6 +2275,11 @@ namespace Mono.CSharp {
                {
                        expr.EmitBranchable (ec, target, on_true);
                }
+
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       expr.MutateHoistedGenericType (storey);
+               }
        }
 
        //
@@ -2769,6 +2779,11 @@ namespace Mono.CSharp {
                        throw new NotSupportedException ("ET");
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       throw new NotSupportedException ();
+               }
+
                public override FullNamedExpression ResolveAsTypeStep (IResolveContext ec, bool silent)
                {
                        return this;
index e0abdb8287a699be293f7cb25c6635938486562b..d892b30a4525b47b11fb3070df5c0de17f332577 100644 (file)
@@ -6265,8 +6265,11 @@ namespace Mono.CSharp {
                                foreach (Argument a in arguments)
                                        a.Expr.MutateHoistedGenericType (storey);
                        }
-
-                       // TODO: finish !!
+                       
+                       if (array_data != null) {
+                               foreach (Expression e in array_data)
+                                       e.MutateHoistedGenericType (storey);
+                       }
                }
 
                //
@@ -6898,6 +6901,12 @@ namespace Mono.CSharp {
                                arg.Emit (ec);
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       foreach (Argument arg in Arguments)
+                               arg.Expr.MutateHoistedGenericType (storey);
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        Arglist target = (Arglist) t;
@@ -7687,6 +7696,11 @@ namespace Mono.CSharp {
                                Expr.EmitBranchable (ec, target, on_true);
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       Expr.MutateHoistedGenericType (storey);
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        CheckedExpr target = (CheckedExpr) t;
@@ -7742,6 +7756,11 @@ namespace Mono.CSharp {
                                Expr.EmitBranchable (ec, target, on_true);
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       Expr.MutateHoistedGenericType (storey);
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        UnCheckedExpr target = (UnCheckedExpr) t;
@@ -8914,6 +8933,12 @@ namespace Mono.CSharp {
                        source.Emit (ec);
                        ec.ig.Emit (OpCodes.Call, method);
                }
+
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       source.MutateHoistedGenericType (storey);
+                       method = storey.MutateGenericMethod (method);
+               }
        }
 
        // <summary>
index f8772c68f44db45685c934b3989240aa1ec6e763..1b114a73bfd2e1c68d22b06e6123e676977919ea 100644 (file)
@@ -221,6 +221,11 @@ namespace Mono.CSharp.Linq
 
                protected abstract string MethodName { get; }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       // Nothing to mutate
+               }
+
                public virtual AQueryClause Next {
                        set {
                                next = value;
@@ -682,6 +687,11 @@ namespace Mono.CSharp.Linq
                        {
                                throw new NotSupportedException ();
                        }
+
+                       public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+                       {
+                               throw new NotSupportedException ();
+                       }
                }
 
                public ImplicitQueryParameter (LocatedToken variable)
index a96f162042ba666c1f7600e0c13091d3bf2b0e8e..f7cb8155d43fcb00ed96692d98886cdaf36be529 100644 (file)
@@ -53,10 +53,10 @@ namespace Mono.CSharp.Nullable
        {
                public readonly Type Type;
                public readonly Type UnderlyingType;
-               public readonly MethodInfo HasValue;
-               public readonly MethodInfo Value;
-               public readonly MethodInfo GetValueOrDefault;
-               public readonly ConstructorInfo Constructor;
+               public MethodInfo HasValue;
+               public MethodInfo Value;
+               public MethodInfo GetValueOrDefault;
+               public ConstructorInfo Constructor;
 
                public NullableInfo (Type type)
                {
@@ -184,6 +184,15 @@ namespace Mono.CSharp.Nullable
                                LocalVariable.Emit (ec);
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       type = storey.MutateType (type);
+                       info.Constructor = storey.MutateConstructor (info.Constructor);
+                       info.HasValue = storey.MutateGenericMethod (info.HasValue);
+                       info.GetValueOrDefault = storey.MutateGenericMethod (info.GetValueOrDefault);
+                       info.Value = storey.MutateGenericMethod (info.Value);
+               }
+
                public void AddressOf (EmitContext ec, AddressOp mode)
                {
                        IMemoryLocation ml = expr as VariableReference;
@@ -1088,6 +1097,13 @@ namespace Mono.CSharp.Nullable
                        ig.MarkLabel (end_label);
                }
 
+               public override void MutateHoistedGenericType (AnonymousMethodStorey storey)
+               {
+                       left.MutateHoistedGenericType (storey);
+                       right.MutateHoistedGenericType (storey);
+                       type = storey.MutateType (type);
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        NullCoalescingOperator target = (NullCoalescingOperator) t;