Dongbo Wang
41f12b1d2c
Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets ( #4709 )
...
When dotting a script cmdlet, the locals of automatic variables from the `PSScriptCmdlet` is not set up in the current scope before parameter binding. The fix is to push the locals in `CommandProcessor.OnSetCurrentScope` and pop them in `CommandProcessor.OnRestorePreviousScope`, which will be called from `SetCurrentScopeToExecutionScope` and `RestorePreviousScope` respectively.
Summary of changes:
1. When a new local scope is used, currently we set the locals for `CommandProcessor` right before parameter binding (in `BindCommandLineParametersNoValidation`); we set the locals for `ScriptCommandProcessor` in `Prepare`. I moved both to the constructor, right after the new scope is created so that the code is more consistent.
2. In `CmdletParameterBinderController.cs`, we set up the `PSBoundParameters` and `MyInvocation` variables in `HandleCommandLineDynamicParameters` again, which I think is unnecessary because this method is only called from `BindCommandLineParametersNoValidation`, where the setup is done for the first time.
3. Currently, the locals will be set for dotted script cmdlet in `EnterScope()` and `ExitScope()`. Now, that logic is moved to `OnSetCurrentScope` and `OnRestorePreviousScope` of `CommandProcessor`. This not only makes sure that locals are set before parameter binding, but also is consistent with the `ScriptCommandProcessor`.
2017-09-06 10:25:33 -07:00
..
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-08-03 15:26:20 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-04 19:45:51 -07:00
2017-09-06 10:25:33 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-09-04 09:11:47 -07:00
2017-01-16 13:31:14 -08:00
2016-08-03 12:14:28 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-09-06 10:25:33 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-07-26 09:20:43 -07:00
2017-01-16 13:31:14 -08:00
2017-06-05 20:59:30 -07:00
2017-07-14 12:28:22 -07:00
2017-09-04 19:45:51 -07:00
2017-01-16 13:31:14 -08:00
2017-09-06 10:25:33 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-09-04 19:45:51 -07:00
2017-09-01 11:50:15 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-06-20 15:08:02 -07:00
2016-08-28 05:44:55 +00:00
2017-01-16 13:31:14 -08:00
2016-08-03 12:06:06 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-17 11:52:38 -07:00
2017-09-04 19:45:51 -07:00
2017-06-05 20:59:30 -07:00
2017-04-17 11:52:38 -07:00
2017-04-17 11:52:38 -07:00
2017-09-04 19:45:51 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-07-17 09:44:54 -07:00
2017-03-07 12:51:28 -08:00
2017-01-16 13:31:14 -08:00
2017-07-29 17:16:23 -07:00
2017-09-04 19:45:51 -07:00
2016-12-01 13:46:56 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-09-04 19:45:51 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-13 13:45:46 -07:00
2017-09-04 19:45:51 -07:00
2017-08-22 17:44:48 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-17 11:52:38 -07:00
2017-01-16 13:31:14 -08:00
2016-12-01 13:46:56 -08:00
2017-05-24 13:30:54 -07:00
2017-01-16 13:31:14 -08:00
2017-08-10 13:32:57 -07:00
2017-01-16 13:31:14 -08:00
2016-08-01 15:57:03 -07:00
2017-07-31 12:49:32 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-07-17 09:44:54 -07:00
2017-01-16 13:31:14 -08:00
2017-08-08 09:20:57 -07:00
2017-07-29 17:16:23 -07:00
2017-08-03 08:34:21 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-17 11:52:38 -07:00
2017-07-31 12:49:11 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-17 11:52:38 -07:00
2017-01-16 13:31:14 -08:00
2016-08-03 12:06:06 -07:00
2017-09-06 10:25:33 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-09-04 19:45:51 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-18 15:40:25 -07:00
2017-01-16 13:31:14 -08:00
2017-09-04 19:45:51 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-17 11:52:38 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2016-12-01 13:46:56 -08:00
2016-08-03 12:06:06 -07:00
2016-08-28 05:44:55 +00:00
2017-01-16 13:31:14 -08:00
2017-07-21 21:03:49 -07:00
2017-07-21 21:03:49 -07:00
2017-08-03 15:29:14 -07:00
2017-01-16 13:31:14 -08:00
2017-08-28 13:19:02 -07:00
2017-01-16 13:31:14 -08:00
2017-01-16 13:31:14 -08:00
2017-04-17 11:52:38 -07:00
2017-01-16 13:31:14 -08:00