2009-01-02 Ivan N. Zlatev <contact@i-nz.net>
[mono.git] / mcs / mcs / decl.cs
index e3095d63e55336196aef70df6390d68ef9231a17..f743f27ede616e2139c489a850fb6d2fc41f56b1 100644 (file)
@@ -1040,7 +1040,7 @@ namespace Mono.CSharp {
                
                public bool CheckAccessLevel (Type check_type)
                {
-                       TypeBuilder tb = TypeBuilder;
+                       Type tb = TypeBuilder;
 #if GMCS_SOURCE
                        if (this is GenericMethod) {
                                tb = Parent.TypeBuilder;
@@ -1056,6 +1056,11 @@ namespace Mono.CSharp {
                        if (check_type == tb)
                                return true;
 
+                       // TODO: When called from LocalUsingAliasEntry tb is null
+                       // because we are in RootDeclSpace
+                       if (tb == null)
+                               tb = typeof (RootDeclSpace);
+
                        //
                        // Broken Microsoft runtime, return public for arrays, no matter what 
                        // the accessibility is for their underlying class, and they return