/// <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="variable"> /// 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 PSVariable variable) { Diagnostics.Assert(name is not FunctionLookupPath, "name was scanned incorrect if we get here and it is a FunctionLookupPath"); bool result = true; variable = scope.GetVariable(name.QualifiedName, _origin); // If the variable is private and the lookup scope // isn't the current scope, claim that the variable // doesn't exist so that the lookup continues. if (variable == null || (variable.IsPrivate && scope != sessionState.CurrentScope)) { result = false; } return(result); }
protected override bool GetScopeItem( SessionStateScope scope, ScopedItemLookupPath name, out PSVariable variable) { bool flag = true; variable = scope.GetVariable(name.LookupPath.ToString(), this._origin); if (variable == null || variable.IsPrivate && scope != this.sessionState.CurrentScope) { flag = false; } return(flag); }