Title: Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets by daxian-dbw · Pull Request #4709 · PowerShell/PowerShell · GitHub
Open Graph Title: Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets by daxian-dbw · Pull Request #4709 · PowerShell/PowerShell
X Title: Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets by daxian-dbw · Pull Request #4709 · PowerShell/PowerShell
Description: Fix #4688 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: 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. 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. 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.
Open Graph Description: Fix #4688 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 Comma...
X Description: Fix #4688 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 Comma...
Opengraph URL: https://github.com/PowerShell/PowerShell/pull/4709
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:42c7a339-e5c5-a928-d93a-32ac8f89b303 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 951C:3E9CB8:5433A5:7A545F:6A57866D |
| html-safe-nonce | 4d51312ec6b19659fdc0316abb3be0299fc1f1121644b209f53bf0cad9b3d7cb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTFDOjNFOUNCODo1NDMzQTU6N0E1NDVGOjZBNTc4NjZEIiwidmlzaXRvcl9pZCI6IjcwMDIzOTAxNDMxODgwMjU0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 91af15f86eb7428202f0d78fdbe8741c27c4dad59137bb6c59eab5a0c436665f |
| hovercard-subject-tag | pull_request:138522248 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/PowerShell/PowerShell/pull/4709/files |
| twitter:image | https://avatars.githubusercontent.com/u/127450?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/127450?s=400&v=4 |
| og:image:alt | Fix #4688 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 Comma... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6353e56e94423c9cd5abde7708a859afa36a0c1203c73749055bf6ee6704cd0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f59ab1c46b638204e2aea09126d089be5dc773b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width