Exemple #1
0
 private void Init()
 {
     _scriptBlock       = base._scriptBlock;
     _obsoleteAttribute = _scriptBlock.ObsoleteAttribute;
     _runOptimizedCode  = _scriptBlock.Compile(optimized: _context._debuggingMode > 0 ? false : UseLocalScope);
     _localsTuple       = _scriptBlock.MakeLocalsTuple(_runOptimizedCode);
 }
        private void Init()
        {
            _scriptBlock       = base._scriptBlock;
            _obsoleteAttribute = _scriptBlock.ObsoleteAttribute;
            _runOptimizedCode  = _scriptBlock.Compile(optimized: _context._debuggingMode <= 0 && UseLocalScope);
            _localsTuple       = _scriptBlock.MakeLocalsTuple(_runOptimizedCode);

            if (UseLocalScope)
            {
                Diagnostics.Assert(CommandScope.LocalsTuple == null, "a newly created scope shouldn't have it's tuple set.");
                CommandScope.LocalsTuple = _localsTuple;
            }
        }
 public PSScriptCmdlet(ScriptBlock scriptBlock, bool useNewScope, bool fromScriptFile, ExecutionContext context)
 {
     _scriptBlock = scriptBlock;
     _useLocalScope = useNewScope;
     _fromScriptFile = fromScriptFile;
     _runOptimized = _scriptBlock.Compile(optimized: context._debuggingMode > 0 ? false : useNewScope);
     _localsTuple = _scriptBlock.MakeLocalsTuple(_runOptimized);
     _localsTuple.SetAutomaticVariable(AutomaticVariable.PSCmdlet, this, context);
     _scriptBlock.SetPSScriptRootAndPSCommandPath(_localsTuple, context);
     _functionContext = new FunctionContext
     {
         _localsTuple = _localsTuple,
         _scriptBlock = _scriptBlock,
         _file = _scriptBlock.File,
         _sequencePoints = _scriptBlock.SequencePoints,
         _debuggerHidden = _scriptBlock.DebuggerHidden,
         _debuggerStepThrough = _scriptBlock.DebuggerStepThrough,
         _executionContext = context,
     };
     _rethrowExitException = context.ScriptCommandProcessorShouldRethrowExit;
     context.ScriptCommandProcessorShouldRethrowExit = false;
 }
 private void Init()
 {
     _scriptBlock = base._scriptBlock;
     _obsoleteAttribute = _scriptBlock.ObsoleteAttribute;
     _runOptimizedCode = _scriptBlock.Compile(optimized: _context._debuggingMode > 0 ? false : UseLocalScope);
     _localsTuple = _scriptBlock.MakeLocalsTuple(_runOptimizedCode);
 }