File tree Expand file tree Collapse file tree 1 file changed +16
-27
lines changed
Expand file tree Collapse file tree 1 file changed +16
-27
lines changed Original file line number Diff line number Diff line change @@ -642,45 +642,34 @@ foreach ($potentialCommand in $potentialCommands) {
642642 $currentClause = @()
643643 }
644644
645+ $commandElementValue =
646+ if ($commandElement.Value -and
647+ $commandElement -isnot [Management.Automation.Language.ExpandableStringExpressionAst]) {
648+ $commandElement.Value
649+ }
650+ elseif ($commandElement -is [Management.Automation.Language.ScriptBlockExpressionAst]) {
651+ [ScriptBlock]::Create($commandElement.Extent.ToString() -replace '^\{' -replace '\}$')
652+ }
653+ else {
654+ $commandElement
655+ }
656+
645657 # If we have a current parameter
646658 if ($currentParameter) {
647659
648660 # Map the current element to this parameter.
649-
650-
651- $mappedParameters[$currentParameter] =
661+ $mappedParameters[$currentParameter] =
652662 if ($mappedParameters[$currentParameter]) {
653- @($mappedParameters[$currentParameter]) + @($commandElement)
663+ @($mappedParameters[$currentParameter]) + $commandElementValue
654664 } else {
655- if ($commandElement.Value) {
656- $commandElement.Value
657- }
658- elseif ($commandElement -is [Management.Automation.Language.ScriptBlockExpressionAst]) {
659- [ScriptBlock]::Create($commandElement.Extent.ToString() -replace '^\{' -replace '\}$')
660- }
661- else {
662- $commandElement
663- }
665+ $commandElementValue
664666 }
665667 $currentClause += $commandElement
666-
667-
668668 } else {
669669 # otherwise add the command element to our unbound parameters.
670- $unboundParameters +=
671- if ($commandElement.Value -and
672- $commandElement -isnot [Management.Automation.Language.ExpandableStringExpressionAst]) {
673- $commandElement.Value
674- }
675- elseif ($commandElement -is [Management.Automation.Language.ScriptBlockExpressionAst]) {
676- [ScriptBlock]::Create($commandElement.Extent.ToString() -replace '^\{' -replace '\}$')
677- }
678- else {
679- $commandElement
680- }
670+ $unboundParameters += $commandElementValue
681671 $currentClause += $commandElement
682672 }
683-
684673 }
685674
686675 if ($currentClause) {
You can’t perform that action at this time.
0 commit comments