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 @@ -360,45 +360,34 @@ foreach ($potentialCommand in $potentialCommands) {
360360 $currentClause = @ ()
361361 }
362362
363+ $commandElementValue =
364+ if ($commandElement.Value -and
365+ $commandElement -isnot [Management.Automation.Language.ExpandableStringExpressionAst ]) {
366+ $commandElement.Value
367+ }
368+ elseif ($commandElement -is [Management.Automation.Language.ScriptBlockExpressionAst ]) {
369+ [ScriptBlock ]::Create($commandElement.Extent.ToString () -replace ' ^\{' -replace ' \}$' )
370+ }
371+ else {
372+ $commandElement
373+ }
374+
363375 # If we have a current parameter
364376 if ($currentParameter ) {
365377
366378 # Map the current element to this parameter.
367-
368-
369- $mappedParameters [$currentParameter ] =
379+ $mappedParameters [$currentParameter ] =
370380 if ($mappedParameters [$currentParameter ]) {
371- @ ($mappedParameters [$currentParameter ]) + @ ( $commandElement )
381+ @ ($mappedParameters [$currentParameter ]) + $commandElementValue
372382 } else {
373- if ($commandElement.Value ) {
374- $commandElement.Value
375- }
376- elseif ($commandElement -is [Management.Automation.Language.ScriptBlockExpressionAst ]) {
377- [ScriptBlock ]::Create($commandElement.Extent.ToString () -replace ' ^\{' -replace ' \}$' )
378- }
379- else {
380- $commandElement
381- }
383+ $commandElementValue
382384 }
383385 $currentClause += $commandElement
384-
385-
386386 } else {
387387 # otherwise add the command element to our unbound parameters.
388- $unboundParameters +=
389- if ($commandElement.Value -and
390- $commandElement -isnot [Management.Automation.Language.ExpandableStringExpressionAst ]) {
391- $commandElement.Value
392- }
393- elseif ($commandElement -is [Management.Automation.Language.ScriptBlockExpressionAst ]) {
394- [ScriptBlock ]::Create($commandElement.Extent.ToString () -replace ' ^\{' -replace ' \}$' )
395- }
396- else {
397- $commandElement
398- }
388+ $unboundParameters += $commandElementValue
399389 $currentClause += $commandElement
400390 }
401-
402391 }
403392
404393 if ($currentClause ) {
You can’t perform that action at this time.
0 commit comments