manually synchronized with 56802
authorMarek Safar <marek.safar@gmail.com>
Sun, 12 Mar 2006 23:16:05 +0000 (23:16 -0000)
committerMarek Safar <marek.safar@gmail.com>
Sun, 12 Mar 2006 23:16:05 +0000 (23:16 -0000)
svn path=/trunk/mcs/; revision=57884

mcs/gmcs/anonymous.cs
mcs/gmcs/attribute.cs
mcs/gmcs/class.cs
mcs/gmcs/codegen.cs
mcs/gmcs/const.cs
mcs/gmcs/decl.cs
mcs/gmcs/delegate.cs
mcs/gmcs/enum.cs
mcs/gmcs/generic.cs
mcs/gmcs/iterators.cs
mcs/gmcs/tree.cs

index d64bc51ff3751c8a597412ad0eb90c05cd2b703b..c5c561875d8038fb694e905887a5bbe936e5bdfc 100644 (file)
@@ -403,7 +403,7 @@ namespace Mono.CSharp {
                        //ILGenerator ig = builder.GetILGenerator ();
 
                        
-                       aec = new EmitContext (
+                       aec = new EmitContext (ec.ResolveContext,
                                ec.TypeContainer, ec.DeclContainer, loc, null,
                                invoke_mb.ReturnType,
                                /* REVIEW */ (ec.InIterator ? Modifiers.METHOD_YIELDS : 0) |
index 04b1078c6d1666391dc039c7a7155f0676fdd598..adb91ab65b25804b40c2099cab430bfd09ad5207 100644 (file)
@@ -184,7 +184,7 @@ namespace Mono.CSharp {
                        DeclSpace container = owner.ResolveContext.DeclContainer;
                        if (owner is TypeParameter)
                                container = ((TypeParameter)owner).DeclSpace;
-                       EmitContext ec = new EmitContext (container, container,
+                       EmitContext ec = new EmitContext (owner.ResolveContext, container, container,
                                        Location, null, null, container.ModFlags, false);
                        //
 
@@ -404,7 +404,7 @@ namespace Mono.CSharp {
                        // First process positional arguments 
                        //
 
-                       EmitContext ec = new EmitContext (owner.ResolveContext.DeclContainer, owner.ResolveContext.DeclContainer,
+                       EmitContext ec = new EmitContext (owner.ResolveContext, owner.ResolveContext.DeclContainer, owner.ResolveContext.DeclContainer,
                                        Location, null, null, owner.ResolveContext.DeclContainer.ModFlags, false);
 
                        int i;
index a603707e9e9943532d628c39cdaf3bb47b6296da..06c1984b58a43398f855f900fee686ef08cf78bf 100644 (file)
@@ -1237,7 +1237,7 @@ namespace Mono.CSharp {
                                ec = null;
                                foreach (ClassPart part in Parts) {
                                        part.TypeBuilder = TypeBuilder;
-                                       part.ec = new EmitContext (part, Mono.CSharp.Location.Null, null, null, ModFlags);
+                                       part.ec = new EmitContext (this, part, Mono.CSharp.Location.Null, null, null, ModFlags);
                                        part.ec.ContainerType = TypeBuilder;
                                }
                        } else {
@@ -1247,7 +1247,7 @@ namespace Mono.CSharp {
                                // we already have the `ec', so we don't want to create a new one.
                                //
                                if (ec == null)
-                                       ec = new EmitContext (this, Mono.CSharp.Location.Null, null, null, ModFlags);
+                                       ec = new EmitContext (this, this, Mono.CSharp.Location.Null, null, null, ModFlags);
                                ec.ContainerType = TypeBuilder;
                        }
 
@@ -4370,7 +4370,7 @@ namespace Mono.CSharp {
 
                public EmitContext CreateEmitContext (TypeContainer tc, ILGenerator ig)
                {
-                       EmitContext ec = new EmitContext (
+                       EmitContext ec = new EmitContext (this,
                                tc, ds, Location, ig, ReturnType, ModFlags, false);
 
                        Iterator iterator = tc as Iterator;
@@ -4889,7 +4889,7 @@ namespace Mono.CSharp {
                public EmitContext CreateEmitContext (TypeContainer tc, ILGenerator ig)
                {
                        ILGenerator ig_ = ConstructorBuilder.GetILGenerator ();
-                       return new EmitContext (Parent, Location, ig_, null, ModFlags, true);
+                       return new EmitContext (this, Parent, Location, ig_, null, ModFlags, true);
                }
 
                public bool IsExcluded()
@@ -6523,7 +6523,7 @@ namespace Mono.CSharp {
                        public override EmitContext CreateEmitContext (TypeContainer tc,
                                                                       ILGenerator ig)
                        {
-                               return new EmitContext (
+                               return new EmitContext (method,
                                        tc, method.ds, method.Location, ig, ReturnType,
                                        method.ModFlags, false);
                        }
@@ -6637,7 +6637,7 @@ namespace Mono.CSharp {
                                return false;
                        }
 
-                       ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
+                       ec = new EmitContext (this, Parent, Location, null, MemberType, ModFlags);
                        return true;
                }
 
index 5b40e65b6374cf44a4e3551a52c11d4a377fe5a6..7c408c21c66db2f9a9afb29394849907ec447b6c 100644 (file)
@@ -403,9 +403,10 @@ namespace Mono.CSharp {
                                              CurrentIterator, capture_context, loc);
                }
                
-               public EmitContext (DeclSpace parent, DeclSpace ds, Location l, ILGenerator ig,
+               public EmitContext (IResolveContext rc, DeclSpace parent, DeclSpace ds, Location l, ILGenerator ig,
                                    Type return_type, int code_flags, bool is_constructor)
                {
+                       this.ResolveContext = rc;
                        this.ig = ig;
 
                        TypeContainer = parent;
@@ -428,10 +429,7 @@ namespace Mono.CSharp {
                        if (parent != null){
                                // Can only be null for the ResolveType contexts.
                                ContainerType = parent.TypeBuilder;
-                               if (parent.UnsafeContext)
-                                       InUnsafe = true;
-                               else
-                                       InUnsafe = (code_flags & Modifiers.UNSAFE) != 0;
+                               InUnsafe = rc.IsInUnsafeScope;
                        }
                        loc = l;
 
@@ -439,15 +437,15 @@ namespace Mono.CSharp {
                                ReturnType = null;
                }
 
-               public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
+               public EmitContext (IResolveContext rc, TypeContainer tc, Location l, ILGenerator ig,
                                    Type return_type, int code_flags, bool is_constructor)
-                       : this (tc, tc, l, ig, return_type, code_flags, is_constructor)
+                       : this (rc, tc, tc, l, ig, return_type, code_flags, is_constructor)
                {
                }
 
-               public EmitContext (TypeContainer tc, Location l, ILGenerator ig,
+               public EmitContext (IResolveContext rc, TypeContainer tc, Location l, ILGenerator ig,
                                    Type return_type, int code_flags)
-                       : this (tc, tc, l, ig, return_type, code_flags, false)
+                       : this (rc, tc, tc, l, ig, return_type, code_flags, false)
                {
                }
 
index 2e562ff2fe589eec44571e692f6fa6c0795a5bbe..7bff36905e80a31ceccbc4cbbab5faf39d181389 100644 (file)
@@ -135,7 +135,7 @@ namespace Mono.CSharp {
                        }
 
                        in_transit = true;
-                       EmitContext ec = new EmitContext (Parent, Location, null, MemberType, ModFlags);
+                       EmitContext ec = new EmitContext (this, Parent, Location, null, MemberType, ModFlags);
                        value = initializer.ResolveAsConstant (ec, this);
                        in_transit = false;
 
index 9d564c596611616a05f573430f3de7cb4d81a4cc..43f467c85f9aaa1d430afa07823b9c93775dd1b2 100644 (file)
@@ -893,7 +893,7 @@ namespace Mono.CSharp {
                                        //
                                        // However, if Parent == RootContext.Tree.Types, its NamespaceEntry will be null.
                                        //
-                                       type_resolve_ec = new EmitContext (Parent, this, Location.Null, null, null, ModFlags, false);
+                                       type_resolve_ec = new EmitContext (this, Parent, this, Location.Null, null, null, ModFlags, false);
                                }
                                return type_resolve_ec;
                        }
index af402246304f92296310ab0a0bdd0b9949c209af..3cfc801ec447493c3b2dd0bd83f8b28da5fdc4f7 100644 (file)
@@ -78,7 +78,7 @@ namespace Mono.CSharp {
                        if (TypeBuilder != null)
                                return TypeBuilder;
 
-                       ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+                       ec = new EmitContext (this, this, this, Location, null, null, ModFlags, false);
 
                        if (IsGeneric) {
                                foreach (TypeParameter type_param in TypeParameters)
index 1858d4c37273093625aaf6bb08064b318670b8fd..e60ed5e09e71700cffa81b73e62b78257c862569 100644 (file)
@@ -43,7 +43,7 @@ namespace Mono.CSharp {
                        this.ValueExpr = expr;
                        this.prev_member = prev_member;
 
-                       ec = new EmitContext (parent_enum, parent_enum, Location, null, null, ModFlags, false);
+                       ec = new EmitContext (this, parent_enum, parent_enum, Location, null, null, ModFlags, false);
                        ec.InEnumContext = true;
                }
 
index 685e70e4acb3e83909752d80d625a168c8d26239..3fb6ce9251fd8852b4e6c1b5227eca979269cce9 100644 (file)
@@ -1737,7 +1737,7 @@ namespace Mono.CSharp {
 
                public override bool Define ()
                {
-                       ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+                       ec = new EmitContext (this, this, this, Location, null, null, ModFlags, false);
 
                        for (int i = 0; i < TypeParameters.Length; i++)
                                if (!TypeParameters [i].Resolve (this))
index c4b0bf4596ed92c2a99448830cafed060e03035d..af4ded2d497005cee804a6084f6a69993586259b 100644 (file)
@@ -387,7 +387,7 @@ namespace Mono.CSharp {
 
                public bool DefineIterator ()
                {
-                       ec = new EmitContext (this, Location, null, null, ModFlags);
+                       ec = new EmitContext (this, this, Location, null, null, ModFlags);
                        ec.CurrentAnonymousMethod = move_next_method;
                        ec.InIterator = true;
 
index 046aabe0361e5195efd896ae3567c8b0072ba99c..c66f17a9979bfd2e2e462d4df4bacd9c7d1c6f3c 100644 (file)
@@ -76,7 +76,7 @@ namespace Mono.CSharp
                public RootTypes ()
                        : base (null, null, MemberName.Null, null, Kind.Root)
                {
-                       ec = new EmitContext (null, this, Location.Null, null, null, 0, false);
+                       ec = new EmitContext (this, null, this, Location.Null, null, null, 0, false);
                }
 
                public override PendingImplementation GetPendingImplementations ()