/// <summary>
        /// Derived classes override this method to return their
        /// particular type of scoped item.
        /// </summary>
        /// <param name="scope">
        /// The scope to look the item up in.
        /// </param>
        /// <param name="name">
        /// The name of the item to retrieve.
        /// </param>
        /// <param name="alias">
        /// The scope item that the derived class should return.
        /// </param>
        /// <returns>
        /// True if the scope item was found or false otherwise.
        /// </returns>
        protected override bool GetScopeItem(
            SessionStateScope scope,
            VariablePath name,
            out AliasInfo alias)
        {
            Diagnostics.Assert(name is not FunctionLookupPath,
                               "name was scanned incorrect if we get here and it is a FunctionLookupPath");

            bool result = true;

            alias = scope.GetAlias(name.QualifiedName);

            // If the alias is private and the lookup scope
            // isn't the current scope, claim that the alias
            // doesn't exist so that the lookup continues.

            if (alias == null ||
                ((alias.Options & ScopedItemOptions.Private) != 0 &&
                 scope != sessionState.CurrentScope))
            {
                result = false;
            }

            return(result);
        }
Exemple #2
0
        protected override bool GetScopeItem(
            SessionStateScope scope,
            ScopedItemLookupPath name,
            out AliasInfo alias)
        {
            bool flag = true;

            alias = scope.GetAlias(name.ToString());
            if (alias == null || (alias.Options & ScopedItemOptions.Private) != ScopedItemOptions.None && scope != this.sessionState.CurrentScope)
            {
                flag = false;
            }
            return(flag);
        }