protected override void OnRestorePreviousScope() { // When dotting a script cmdlet, pop the locals of automatic variables from // the 'DottedScopes' of the current scope. PSScriptCmdlet scriptCmdlet = this.Command as PSScriptCmdlet; if (scriptCmdlet != null && !UseLocalScope) { scriptCmdlet.PopDottedScope(CommandSessionState.CurrentScope); } }
private void Init(IScriptCommandInfo scriptCommandInfo) { InternalCommand command = new PSScriptCmdlet(scriptCommandInfo.ScriptBlock, base._useLocalScope, base.FromScriptFile, base._context); base.Command = command; base.CommandScope = base._useLocalScope ? base.CommandSessionState.NewScope(base._fromScriptFile) : base.CommandSessionState.CurrentScope; this.InitCommon(); if (!base.UseLocalScope) { CommandProcessorBase.ValidateCompatibleLanguageMode(scriptCommandInfo.ScriptBlock, base._context.LanguageMode, base.Command.MyInvocation); } }
private void Init(IScriptCommandInfo scriptCommandInfo) { PSScriptCmdlet psScriptCmdlet = new PSScriptCmdlet(scriptCommandInfo.ScriptBlock); psScriptCmdlet.UseLocalScope = this._useLocalScope; if (scriptCommandInfo.ScriptBlock.SessionStateInternal != null) { this.CommandSessionState = scriptCommandInfo.ScriptBlock.SessionStateInternal; } this.Command = (InternalCommand)psScriptCmdlet; this.InitCommon(); }
private void Init(IScriptCommandInfo scriptCommandInfo) { InternalCommand scriptCmdlet = new PSScriptCmdlet(scriptCommandInfo.ScriptBlock, _useLocalScope, FromScriptFile, _context); this.Command = scriptCmdlet; this.CommandScope = _useLocalScope ? this.CommandSessionState.NewScope(_fromScriptFile) : this.CommandSessionState.CurrentScope; InitCommon(); // If the script has been dotted, throw an error if it's from a different language mode. if (!this.UseLocalScope) { ValidateCompatibleLanguageMode(scriptCommandInfo.ScriptBlock, _context.LanguageMode, Command.MyInvocation); } }
private void Init(IScriptCommandInfo scriptCommandInfo) { var scriptCmdlet = new PSScriptCmdlet(scriptCommandInfo.ScriptBlock, UseLocalScope, FromScriptFile, _context); this.Command = scriptCmdlet; this.CommandScope = UseLocalScope ? this.CommandSessionState.NewScope(_fromScriptFile) : this.CommandSessionState.CurrentScope; if (UseLocalScope) { // Set the 'LocalsTuple' of the new scope to that of the scriptCmdlet scriptCmdlet.SetLocalsTupleForNewScope(CommandScope); } InitCommon(); // If the script has been dotted, throw an error if it's from a different language mode. if (!this.UseLocalScope) { ValidateCompatibleLanguageMode(scriptCommandInfo.ScriptBlock, _context.LanguageMode, Command.MyInvocation); } }
private void Init(IScriptCommandInfo scriptCommandInfo) { InternalCommand scriptCmdlet = new PSScriptCmdlet(scriptCommandInfo.ScriptBlock, _useLocalScope, FromScriptFile, _context); this.Command = scriptCmdlet; this.CommandScope = _useLocalScope ? this.CommandSessionState.NewScope(_fromScriptFile) : this.CommandSessionState.CurrentScope; InitCommon(); // If the script has been dotted, throw an error if it's from a different language mode. if (!this.UseLocalScope) { ValidateCompatibleLanguageMode(scriptCommandInfo.ScriptBlock, _context.LanguageMode, Command.MyInvocation); } }
private void Init(IScriptCommandInfo scriptCommandInfo) { InternalCommand command = new PSScriptCmdlet(scriptCommandInfo.ScriptBlock, base._useLocalScope, base.FromScriptFile, base._context); base.Command = command; base.CommandScope = base._useLocalScope ? base.CommandSessionState.NewScope(base._fromScriptFile) : base.CommandSessionState.CurrentScope; this.InitCommon(); if (!base.UseLocalScope) { CommandProcessorBase.ValidateCompatibleLanguageMode(scriptCommandInfo.ScriptBlock, base._context.LanguageMode, base.Command.MyInvocation); } }