2009-08-24 Marek Safar <marek.safar@gmail.com>
authorMarek Safar <marek.safar@gmail.com>
Mon, 24 Aug 2009 15:13:20 +0000 (15:13 -0000)
committerMarek Safar <marek.safar@gmail.com>
Mon, 24 Aug 2009 15:13:20 +0000 (15:13 -0000)
* *.cs: Only ResolveContext implements IMemberContext.

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

14 files changed:
mcs/mcs/ChangeLog
mcs/mcs/anonymous.cs
mcs/mcs/attribute.cs
mcs/mcs/class.cs
mcs/mcs/codegen.cs
mcs/mcs/convert.cs
mcs/mcs/decl.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/generic-mcs.cs
mcs/mcs/generic.cs
mcs/mcs/namespace.cs
mcs/mcs/parameter.cs
mcs/mcs/statement.cs

index fb73facfb6de52c602e314eb2f947d8617ace4f9..1f7db076d386fdca3f5ab870c5be7da778defb57 100644 (file)
@@ -1,3 +1,7 @@
+2009-08-24  Marek Safar  <marek.safar@gmail.com>
+
+       * *.cs: Only ResolveContext implements IMemberContext.
+
 2009-08-21  Marek Safar  <marek.safar@gmail.com>
 
        * *.cs: Renamed IResolveContext to IMemberContext.
index 1affc38ceb1da0089fcf6e9102be33e0a7de35a0..5724027e71d214596b98b1244033d56a9dddccf3 100644 (file)
@@ -1310,7 +1310,7 @@ namespace Mono.CSharp {
                        if (ec.HasSet (EmitContext.Options.FieldInitializerScope))
                                flags |= EmitContext.Options.FieldInitializerScope;
 
-                       if (ec.InUnsafe)
+                       if (ec.IsUnsafe)
                                flags |= EmitContext.Options.UnsafeScope;
 
                        // HACK: Flag with 0 cannot be set 
index 77a6a84894f6f916efde05e90140ad77c5f8bb26..9e7a332a74d1a5185de130211212cc300e79115e 100644 (file)
@@ -614,7 +614,7 @@ namespace Mono.CSharp {
                                        field_infos.Add (fi);
                                }
 
-                               if (obsolete_attr != null && !context.IsInObsoleteScope)
+                               if (obsolete_attr != null && !context.IsObsolete)
                                        AttributeTester.Report_ObsoleteMessage (obsolete_attr, member.GetSignatureForError (), member.Location);
                        }
 
index b45952b915335eb8970b92a8d4173cc007883ee0..2c9e4d19f1cbbcb5c1a50adf78d9326478790d34 100644 (file)
@@ -186,12 +186,12 @@ namespace Mono.CSharp {
                                get { return tc.Parent; }
                        }
 
-                       public bool IsInObsoleteScope {
-                               get { return tc.IsInObsoleteScope; }
+                       public bool IsObsolete {
+                               get { return tc.IsObsolete; }
                        }
 
-                       public bool IsInUnsafeScope {
-                               get { return tc.IsInUnsafeScope; }
+                       public bool IsUnsafe {
+                               get { return tc.IsUnsafe; }
                        }
 
                        public bool IsStatic {
@@ -1342,7 +1342,7 @@ namespace Mono.CSharp {
                        if (iface_exprs != null) {
                                foreach (TypeExpr iface in iface_exprs) {
                                        ObsoleteAttribute oa = AttributeTester.GetObsoleteAttribute (iface.Type);
-                                       if ((oa != null) && !IsInObsoleteScope)
+                                       if ((oa != null) && !IsObsolete)
                                                AttributeTester.Report_ObsoleteMessage (
                                                        oa, iface.GetSignatureForError (), Location);
 
@@ -1359,7 +1359,7 @@ namespace Mono.CSharp {
 
                        if (base_type != null) {
                                ObsoleteAttribute obsolete_attr = AttributeTester.GetObsoleteAttribute (base_type.Type);
-                               if (obsolete_attr != null && !IsInObsoleteScope)
+                               if (obsolete_attr != null && !IsObsolete)
                                        AttributeTester.Report_ObsoleteMessage (obsolete_attr, base_type.GetSignatureForError (), Location);
 
                                GenericTypeExpr ct = base_type as GenericTypeExpr;
@@ -5146,7 +5146,7 @@ namespace Mono.CSharp {
                                        parent_method = implementing;
 
                                EmitContext ec = method.CreateEmitContext (null);
-                               if (!GenericMethod.DefineType (ec, builder, parent_method, is_override))
+                               if (!GenericMethod.DefineType (ec.MemberContext, builder, parent_method, is_override))
                                        return false;
                        }
 
@@ -5712,7 +5712,7 @@ namespace Mono.CSharp {
                {
                        base.DoMemberTypeIndependentChecks ();
 
-                       if (!Parent.IsInUnsafeScope)
+                       if (!Parent.IsUnsafe)
                                Expression.UnsafeError (Location);
 
                        if (Parent.PartialContainer.Kind != Kind.Struct) {
index 7be481ebbb5739702563b72ac9940018266f4735..11b36c4dd2f6f34a1d7a0a0a6abbfa3be07a6701 100644 (file)
@@ -271,8 +271,8 @@ namespace Mono.CSharp {
                //
                TypeContainer CurrentTypeDefinition { get; }
 
-               bool IsInObsoleteScope { get; }
-               bool IsInUnsafeScope { get; }
+               bool IsObsolete { get; }
+               bool IsUnsafe { get; }
                bool IsStatic { get; }
 
                ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, string name, Location loc);
@@ -400,7 +400,7 @@ namespace Mono.CSharp {
        ///   An Emit Context is created for each body of code (from methods,
        ///   properties bodies, indexer bodies or constructor bodies)
        /// </summary>
-       public class EmitContext : IMemberContext {
+       public class EmitContext {
 
                [Flags]
                public enum Options
@@ -593,10 +593,6 @@ namespace Mono.CSharp {
                        get { return MemberContext.CurrentTypeDefinition; }
                }
 
-               public bool InUnsafe {
-                       get { return HasSet (Options.UnsafeScope) || MemberContext.IsInUnsafeScope; }
-               }
-
                public bool HasSet (Options options)
                {
                        return (this.flags & options) == options;
@@ -626,22 +622,6 @@ namespace Mono.CSharp {
                        return new FlagsHandle (this, Options.DoFlowAnalysis | Options.OmitStructFlowAnalysis, newflags);
                }
                
-               // IResolveContext.IsInObsoleteScope
-               public bool IsInObsoleteScope {
-                       get {
-                               // Disables obsolete checks when probing is on
-                               return IsInProbingMode || MemberContext.IsInObsoleteScope;
-                       }
-               }
-
-               public bool IsInProbingMode {
-                       get { return (flags & Options.ProbingMode) != 0; }
-               }
-
-               bool IMemberContext.IsInUnsafeScope {
-                       get { return InUnsafe; }
-               }
-
                public bool IsStatic {
                        get { return MemberContext.IsStatic; }
                }
@@ -774,28 +754,9 @@ namespace Mono.CSharp {
 
                        return return_value;
                }
-
-               #region IResolveContext Members
-
-               public ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, string name, Location loc)
-               {
-                       return MemberContext.LookupExtensionMethod (extensionType, name, loc);
-               }
-
-               public FullNamedExpression LookupNamespaceOrType (string name, Location loc, bool ignore_cs0104)
-               {
-                       return MemberContext.LookupNamespaceOrType (name, loc, ignore_cs0104);
-               }
-
-               public FullNamedExpression LookupNamespaceAlias (string name)
-               {
-                       return MemberContext.LookupNamespaceAlias (name);
-               }
-
-               #endregion
        }
 
-       public class ResolveContext : EmitContext
+       public class ResolveContext : EmitContext, IMemberContext
        {
                //
                // Holds a varible used during collection or object initialization.
@@ -821,6 +782,10 @@ namespace Mono.CSharp {
                        get { return (flags & Options.DoFlowAnalysis) != 0; }
                }
 
+               public bool IsInProbingMode {
+                       get { return (flags & Options.ProbingMode) != 0; }
+               }
+
                public bool IsVariableCapturingRequired {
                        get {
                                return !IsInProbingMode && (CurrentBranching == null || !CurrentBranching.CurrentUsageVector.IsUnreachable);
@@ -858,6 +823,36 @@ namespace Mono.CSharp {
 
                        return local.Block.Toplevel != CurrentBlock.Toplevel;
                }
+
+               #region IMemberContext Members
+
+               public bool IsObsolete {
+                       get {
+                               // Disables obsolete checks when probing is on
+                               return IsInProbingMode || MemberContext.IsObsolete;
+                       }
+               }
+
+               public bool IsUnsafe {
+                       get { return HasSet (Options.UnsafeScope) || MemberContext.IsUnsafe; }
+               }
+
+               public ExtensionMethodGroupExpr LookupExtensionMethod (Type extensionType, string name, Location loc)
+               {
+                       return MemberContext.LookupExtensionMethod (extensionType, name, loc);
+               }
+
+               public FullNamedExpression LookupNamespaceOrType (string name, Location loc, bool ignore_cs0104)
+               {
+                       return MemberContext.LookupNamespaceOrType (name, loc, ignore_cs0104);
+               }
+
+               public FullNamedExpression LookupNamespaceAlias (string name)
+               {
+                       return MemberContext.LookupNamespaceAlias (name);
+               }
+
+               #endregion
        }
 
 
@@ -910,11 +905,11 @@ namespace Mono.CSharp {
                        get { return RootContext.ToplevelTypes; }
                }
 
-               public bool IsInObsoleteScope {
+               public bool IsObsolete {
                        get { return false; }
                }
 
-               public bool IsInUnsafeScope {
+               public bool IsUnsafe {
                        get { return false; }
                }
 
index 633d71cc992e2b7061f99d801352c531554a73ba..d9c903690fdbb60222d469c0cb56f1d603834df4 100644 (file)
@@ -1269,7 +1269,7 @@ namespace Mono.CSharp {
                                        return new EnumConstant (i, target_type);
                        }
 
-                       if (ec.InUnsafe) {
+                       if (ec.IsUnsafe) {
                                if (expr_type.IsPointer){
                                        if (target_type == TypeManager.void_ptr_type)
                                                return EmptyCast.Create (expr, target_type);
@@ -1791,7 +1791,7 @@ namespace Mono.CSharp {
                                        return ne;
                        }
 
-                       if (ec.InUnsafe){
+                       if (ec.IsUnsafe){
                                ne = ExplicitUnsafe (expr, target_type);
                                if (ne != null)
                                        return ne;
@@ -1861,7 +1861,7 @@ namespace Mono.CSharp {
                        if (ne != null)
                                return ne;
 
-                       if (ec.InUnsafe && expr.Type == TypeManager.void_ptr_type && target_type.IsPointer)
+                       if (ec.IsUnsafe && expr.Type == TypeManager.void_ptr_type && target_type.IsPointer)
                                return EmptyCast.Create (expr, target_type);
 
                        expr.Error_ValueCannotBeConverted (ec, l, target_type, true);
index 617f9e3a7f4498558ac96bafb84096af2ae0348f..e2291cc3dcd778c257ccb060039fcbba446d3fa6 100644 (file)
@@ -836,21 +836,21 @@ namespace Mono.CSharp {
                        get { return Parent; }
                }
 
-               public bool IsInObsoleteScope {
+               public bool IsObsolete {
                        get {
                                if (GetObsoleteAttribute () != null)
                                        return true;
 
-                               return Parent == null ? false : Parent.IsInObsoleteScope;
+                               return Parent == null ? false : Parent.IsObsolete;
                        }
                }
 
-               public bool IsInUnsafeScope {
+               public bool IsUnsafe {
                        get {
                                if ((ModFlags & Modifiers.UNSAFE) != 0)
                                        return true;
 
-                               return Parent == null ? false : Parent.IsInUnsafeScope;
+                               return Parent == null ? false : Parent.IsUnsafe;
                        }
                }
 
@@ -2763,7 +2763,7 @@ namespace Mono.CSharp {
                                                const int partial_modifiers = Modifiers.STATIC | Modifiers.UNSAFE;
                                                if (method_a.IsPartialDefinition == method_b.IsPartialImplementation) {
                                                        if ((method_a.ModFlags & partial_modifiers) == (method_b.ModFlags & partial_modifiers) ||
-                                                               method_a.Parent.IsInUnsafeScope && method_b.Parent.IsInUnsafeScope) {
+                                                               method_a.Parent.IsUnsafe && method_b.Parent.IsUnsafe) {
                                                                if (method_a.IsPartialImplementation) {
                                                                        method_a.SetPartialDefinition (method_b);
                                                                        entries.RemoveAt (i);
index bc9184e0a97057d12d5c070925c1dc89835f598f..f21b5b471e7046060558f024b80519da841ec031 100644 (file)
@@ -275,7 +275,7 @@ namespace Mono.CSharp {
 
                        if (!silent) { // && !(te is TypeParameterExpr)) {
                                ObsoleteAttribute obsolete_attr = AttributeTester.GetObsoleteAttribute (te.Type);
-                               if (obsolete_attr != null && !ec.IsInObsoleteScope) {
+                               if (obsolete_attr != null && !ec.IsObsolete) {
                                        AttributeTester.Report_ObsoleteMessage (obsolete_attr, te.GetSignatureForError (), Location);
                                }
                        }
@@ -3093,7 +3093,7 @@ namespace Mono.CSharp {
                                // TODO: Same problem as in class.cs, TypeTerminal does not
                                // always do all necessary checks
                                ObsoleteAttribute oa = AttributeTester.GetObsoleteAttribute (left.Type);
-                               if (oa != null && !ec.IsInObsoleteScope) {
+                               if (oa != null && !ec.IsObsolete) {
                                        AttributeTester.Report_ObsoleteMessage (oa, left.GetSignatureForError (), loc);
                                }
 
@@ -4469,7 +4469,7 @@ namespace Mono.CSharp {
                        // Check ObsoleteAttribute on the best method
                        //
                        ObsoleteAttribute oa = AttributeTester.GetMethodObsoleteAttribute (the_method);
-                       if (oa != null && !ec.IsInObsoleteScope)
+                       if (oa != null && !ec.IsObsolete)
                                AttributeTester.Report_ObsoleteMessage (oa, GetSignatureForError (), loc);
 
                        IMethodData data = TypeManager.GetMethod (the_method);
@@ -4618,7 +4618,7 @@ namespace Mono.CSharp {
                                return false;
                        }
 
-                       if (has_unsafe_arg && !ec.InUnsafe) {
+                       if (has_unsafe_arg && !ec.IsUnsafe) {
                                if (!may_fail)
                                        UnsafeError (loc);
                                return false;
@@ -4683,7 +4683,7 @@ namespace Mono.CSharp {
                {
                        IConstant ic = TypeManager.GetConstant (constant);
                        if (ic.ResolveValue ()) {
-                               if (!ec.IsInObsoleteScope)
+                               if (!ec.IsObsolete)
                                        ic.CheckObsoleteness (loc);
                        }
 
@@ -4773,7 +4773,7 @@ namespace Mono.CSharp {
                        FieldInfo fi = TypeManager.GetGenericFieldDefinition (FieldInfo);
                        Type t = fi.FieldType;
 
-                       if (t.IsPointer && !ec.InUnsafe) {
+                       if (t.IsPointer && !ec.IsUnsafe) {
                                UnsafeError (loc);
                        }
 
@@ -4856,7 +4856,7 @@ namespace Mono.CSharp {
                        if (eclass != ExprClass.Invalid)
                                return this;
 
-                       if (!ec.IsInObsoleteScope) {
+                       if (!ec.IsObsolete) {
                                FieldBase f = TypeManager.GetField (FieldInfo);
                                if (f != null) {
                                        f.CheckObsoleteness (loc);
@@ -5516,11 +5516,11 @@ namespace Mono.CSharp {
                                Error_CannotCallAbstractBase (TypeManager.GetFullNameSignature (PropertyInfo));
                        }
 
-                       if (PropertyInfo.PropertyType.IsPointer && !ec.InUnsafe){
+                       if (PropertyInfo.PropertyType.IsPointer && !ec.IsUnsafe){
                                UnsafeError (loc);
                        }
 
-                       if (!ec.IsInObsoleteScope) {
+                       if (!ec.IsObsolete) {
                                PropertyBase pb = TypeManager.GetProperty (PropertyInfo);
                                if (pb != null) {
                                        pb.CheckObsoleteness (loc);
@@ -5603,11 +5603,11 @@ namespace Mono.CSharp {
                                Error_CannotCallAbstractBase (TypeManager.GetFullNameSignature (PropertyInfo));
                        }
 
-                       if (PropertyInfo.PropertyType.IsPointer && !ec.InUnsafe) {
+                       if (PropertyInfo.PropertyType.IsPointer && !ec.IsUnsafe) {
                                UnsafeError (loc);
                        }
 
-                       if (!ec.IsInObsoleteScope) {
+                       if (!ec.IsObsolete) {
                                PropertyBase pb = TypeManager.GetProperty (PropertyInfo);
                                if (pb != null) {
                                        pb.CheckObsoleteness (loc);
@@ -5757,7 +5757,7 @@ namespace Mono.CSharp {
                                EventField mi = TypeManager.GetEventField (EventInfo);
 
                                if (mi != null) {
-                                       if (!ec.IsInObsoleteScope)
+                                       if (!ec.IsObsolete)
                                                mi.CheckObsoleteness (loc);
 
                                        if ((mi.ModFlags & (Modifiers.ABSTRACT | Modifiers.EXTERN)) != 0 && !ec.HasSet (EmitContext.Options.CompoundAssignmentScope))
@@ -5853,7 +5853,7 @@ namespace Mono.CSharp {
                                return null;
                        }
 
-                       if (!ec.IsInObsoleteScope) {
+                       if (!ec.IsObsolete) {
                                EventField ev = TypeManager.GetEventField (EventInfo);
                                if (ev != null) {
                                        ev.CheckObsoleteness (loc);
index 8c2b12231c32cedff0fb94c643d82dd984173c89..804f57dc63dd24f6a672c8ae7ce8831369f9b355 100644 (file)
@@ -611,7 +611,7 @@ namespace Mono.CSharp {
 
                Expression ResolveAddressOf (ResolveContext ec)
                {
-                       if (!ec.InUnsafe)
+                       if (!ec.IsUnsafe)
                                UnsafeError (loc);
 
                        Expr = Expr.DoResolveLValue (ec, EmptyExpression.UnaryAddress);
@@ -855,7 +855,7 @@ namespace Mono.CSharp {
                        if (expr == null)
                                return null;
 
-                       if (!ec.InUnsafe)
+                       if (!ec.IsUnsafe)
                                UnsafeError (loc);
 
                        if (!expr.Type.IsPointer) {
@@ -1553,7 +1553,7 @@ namespace Mono.CSharp {
                                        return c;
                        }
 
-                       if (type.IsPointer && !ec.InUnsafe) {
+                       if (type.IsPointer && !ec.IsUnsafe) {
                                UnsafeError (loc);
                        } else if (TypeManager.IsDynamicType (expr.Type)) {
                                Arguments arg = new Arguments (1);
@@ -4856,7 +4856,7 @@ namespace Mono.CSharp {
                        }
 
                        if (type.IsPointer){
-                               if (!ec.InUnsafe){
+                               if (!ec.IsUnsafe){
                                        UnsafeError (loc);
                                        return null;
                                }
@@ -6857,7 +6857,7 @@ namespace Mono.CSharp {
 
                        if (typearg == TypeManager.void_type) {
                                Report.Error (673, loc, "System.Void cannot be used from C#. Use typeof (void) to get the void type object");
-                       } else if (typearg.IsPointer && !ec.InUnsafe){
+                       } else if (typearg.IsPointer && !ec.IsUnsafe){
                                UnsafeError (loc);
                        } else if (texpr is DynamicTypeExpr) {
                                Report.Error (1962, QueriedType.Location,
@@ -7165,7 +7165,7 @@ namespace Mono.CSharp {
                                return null;
                        }
 
-                       if (!ec.InUnsafe) {
+                       if (!ec.IsUnsafe) {
                                Report.Error (233, loc,
                                        "`{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf)",
                                        TypeManager.CSharpName (type_queried));
@@ -7895,7 +7895,7 @@ namespace Mono.CSharp {
                        }
 
                        type = TypeManager.GetElementType (t);
-                       if (type.IsPointer && !ec.InUnsafe) {
+                       if (type.IsPointer && !ec.IsUnsafe) {
                                UnsafeError (ea.Location);
                        }
 
@@ -8433,7 +8433,7 @@ namespace Mono.CSharp {
                        }
 
                        type = TypeManager.TypeToCoreType (pi.PropertyType);
-                       if (type.IsPointer && !ec.InUnsafe)
+                       if (type.IsPointer && !ec.IsUnsafe)
                                UnsafeError (loc);
 
                        MethodInfo accessor;
@@ -8946,7 +8946,7 @@ namespace Mono.CSharp {
                        if (type == null)
                                throw new InternalErrorException ("Couldn't create computed type " + ltype + dim);
 
-                       if (type.IsPointer && !ec.IsInUnsafeScope){
+                       if (type.IsPointer && !ec.IsUnsafe){
                                UnsafeError (loc);
                        }
 
index 64bca2aeab8109c961914bef9ac8f98739be435f..d512efb2953a37ad8df0bae7e3ff109daa5cd17a 100644 (file)
@@ -344,7 +344,7 @@ namespace Mono.CSharp
                        throw new NotImplementedException ();
                }
 
-               public bool DefineType (EmitContext ec, MethodBuilder mb,
+               public bool DefineType (IMemberContext ec, MethodBuilder mb,
                                        MethodInfo implementing, bool is_override)
                {
                        throw new NotImplementedException ();
index ee04036eb43ab2df330d99d3f48ee961f3f640d1..bede8baeb4b2d69daa9e5bd3c7ca679c21351f0e 100644 (file)
@@ -1670,7 +1670,7 @@ namespace Mono.CSharp {
                protected abstract string GetSignatureForError ();
                protected abstract void Report_SymbolRelatedToPreviousError ();
 
-               public static bool CheckConstraints (EmitContext ec, MethodBase definition,
+               public static bool CheckConstraints (IMemberContext ec, MethodBase definition,
                                                     MethodBase instantiated, Location loc)
                {
                        MethodConstraintChecker checker = new MethodConstraintChecker (
@@ -1817,7 +1817,7 @@ namespace Mono.CSharp {
                /// <summary>
                ///   We're called from MethodData.Define() after creating the MethodBuilder.
                /// </summary>
-               public bool DefineType (EmitContext ec, MethodBuilder mb,
+               public bool DefineType (IMemberContext ec, MethodBuilder mb,
                                        MethodInfo implementing, bool is_override)
                {
                        for (int i = 0; i < TypeParameters.Length; i++)
index 9ac046545bd538cccae5f106f4399c1ae5e13492..8597ce4ef2350a0eee8119546c03a9213df99c7b 100644 (file)
@@ -1327,12 +1327,12 @@ namespace Mono.CSharp {
                        get { return SlaveDeclSpace; }
                }
 
-               public bool IsInObsoleteScope {
-                       get { return SlaveDeclSpace.IsInObsoleteScope; }
+               public bool IsObsolete {
+                       get { return SlaveDeclSpace.IsObsolete; }
                }
 
-               public bool IsInUnsafeScope {
-                       get { return SlaveDeclSpace.IsInUnsafeScope; }
+               public bool IsUnsafe {
+                       get { return SlaveDeclSpace.IsUnsafe; }
                }
 
                public bool IsStatic {
index 227d8f494a0eff563414c4eaece322b1bc217bad..94dc4280b159a722bd4d8b153df1c4111fb675e2 100644 (file)
@@ -616,7 +616,7 @@ namespace Mono.CSharp {
                //
                // System.Linq.Expressions.ParameterExpression type
                //
-               public static TypeExpr ResolveParameterExpressionType (EmitContext ec, Location location)
+               public static TypeExpr ResolveParameterExpressionType (IMemberContext ec, Location location)
                {
                        if (parameter_expr_tree_type != null)
                                return parameter_expr_tree_type;
index 373b03afc02a02072784e71f946e3a7399c00ee6..366bc042c992bf5bc36bc6b8226df9daf9716899 100644 (file)
@@ -1380,7 +1380,7 @@ namespace Mono.CSharp {
                                return false;
                        }
 
-                       if (VariableType.IsPointer && !ec.InUnsafe)
+                       if (VariableType.IsPointer && !ec.IsUnsafe)
                                Expression.UnsafeError (Location);
 
                        return true;
@@ -2086,7 +2086,7 @@ namespace Mono.CSharp {
 
                        // If some parent block was unsafe, we remain unsafe even if this block
                        // isn't explicitly marked as such.
-                       using (ec.With (EmitContext.Options.UnsafeScope, ec.InUnsafe | Unsafe)) {
+                       using (ec.With (EmitContext.Options.UnsafeScope, ec.IsUnsafe | Unsafe)) {
                                flags |= Flags.VariablesInitialized;
 
                                if (variables != null) {
@@ -4451,7 +4451,7 @@ namespace Mono.CSharp {
 
                public override bool Resolve (BlockContext ec)
                {
-                       if (!ec.InUnsafe){
+                       if (!ec.IsUnsafe){
                                Expression.UnsafeError (loc);
                                return false;
                        }