GetPackage() 개인적인 메소드

private GetPackage ( ) : PackageScope
리턴 PackageScope
예제 #1
0
        internal bool IsAccessibleFrom(ScriptObject scope) //Never call this if the member is public
        {
            while (scope != null && !(scope is ClassScope))
            {
                scope = scope.GetParent();
            }
            ClassScope objType = null;

            if (this.obj is ClassScope)
            {
                objType = (ClassScope)this.obj;
            }
            else
            {
                objType = (ClassScope)((ScriptObject)this.obj).GetParent();
            }
            if (this.IsPrivate)
            {
                if (scope == null)
                {
                    return(false);
                }
                else
                {
                    return(scope == objType || ((ClassScope)scope).IsNestedIn(objType, this.IsStatic));
                }
            }
            else if (this.IsFamily)
            {
                if (scope == null)
                {
                    return(false);
                }
                else
                {
                    return(((ClassScope)scope).IsSameOrDerivedFrom(objType) || ((ClassScope)scope).IsNestedIn(objType, this.IsStatic));
                }
            }
            else //if (this.IsAssembly || this.IsFamilyOrAssembly)
            {
                if (this.IsFamilyOrAssembly && scope != null &&
                    (((ClassScope)scope).IsSameOrDerivedFrom(objType) || ((ClassScope)scope).IsNestedIn(objType, this.IsStatic)))
                {
                    return(true);
                }
                else if (scope == null)                   //Code is not in a class and hence it is in the default package
                {
                    return(objType.GetPackage() == null); //null indicates default package
                }
                else
                {
                    return(objType.GetPackage() == ((ClassScope)scope).GetPackage());
                }
            }
        }
예제 #2
0
        internal bool IsAccessibleFrom(ScriptObject scope)
        {
            while ((scope != null) && !(scope is ClassScope))
            {
                scope = scope.GetParent();
            }
            ClassScope other = null;

            if (base.obj is ClassScope)
            {
                other = (ClassScope)base.obj;
            }
            else
            {
                other = (ClassScope)base.obj.GetParent();
            }
            if (base.IsPrivate)
            {
                if (scope == null)
                {
                    return(false);
                }
                if (scope != other)
                {
                    return(((ClassScope)scope).IsNestedIn(other, base.IsStatic));
                }
                return(true);
            }
            if (base.IsFamily)
            {
                if (scope == null)
                {
                    return(false);
                }
                if (!((ClassScope)scope).IsSameOrDerivedFrom(other))
                {
                    return(((ClassScope)scope).IsNestedIn(other, base.IsStatic));
                }
                return(true);
            }
            if ((base.IsFamilyOrAssembly && (scope != null)) && (((ClassScope)scope).IsSameOrDerivedFrom(other) || ((ClassScope)scope).IsNestedIn(other, base.IsStatic)))
            {
                return(true);
            }
            if (scope == null)
            {
                return(other.GetPackage() == null);
            }
            return(other.GetPackage() == ((ClassScope)scope).GetPackage());
        }
예제 #3
0
        internal bool IsAccessibleFrom(ScriptObject scope) //Never call this if the member is public
        {
            while (scope != null && !(scope is ClassScope))
            {
                scope = scope.GetParent();
            }
            ClassScope thisScope = (ClassScope)this.cons.enclosing_scope;

            if (this.IsPrivate)
            {
                if (scope == null)
                {
                    return(false);
                }
                else
                {
                    return(scope == thisScope || ((ClassScope)scope).IsNestedIn(thisScope, false));
                }
            }
            else if (this.IsFamily)
            {
                if (scope == null)
                {
                    return(false);
                }
                else
                {
                    return(((ClassScope)scope).IsSameOrDerivedFrom(thisScope) || ((ClassScope)scope).IsNestedIn(thisScope, false));
                }
            }
            else //if (this.IsAssembly)
            if (scope == null) //Code is not in a class and hence it is in the default package
            {
                return(thisScope.GetPackage() == null); //null indicates default package
            }
            else
            {
                return(thisScope.GetPackage() == ((ClassScope)scope).GetPackage());
            }
        }