File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -388,21 +388,27 @@ function Join-PipeScript
388388 if ($block.Unnamed -and -not $blockOpen ) {
389389 ' ' * ($block | MeasureIndent) + ' end {'
390390 $blockOpen = $true
391+ $closeEndBlock = $true
391392 }
392393 if ($StatementsToAdd ) {
393394 $StatementsToAdd -join [Environment ]::NewLine
394395 $StatementsToAdd = $null
395396 }
396- $block.Extent.ToString () -replace ' ^end\s{0,}\{' -replace ' \}$' -replace ' ^param\(\)[\s\r\n]{0,}'
397+ if ($block.Unnamed ) {
398+ $block.Extent.ToString ()
399+ } else {
400+ $block.Extent.ToString () -replace ' ^end\s{0,}\{' -replace ' \}$' -replace ' ^param\(\)[\s\r\n]{0,}'
401+ }
397402 }
398403 }
399404
400405 if ($StatementsToAdd ) {
401406 if ($closeEndBlock -and -not $blockOpen ) {
402407 ' end {'
408+ $blockOpen = $true
403409 }
404410 $StatementsToAdd -join [Environment ]::NewLine
405- $StatementsToAdd = $null
411+ $StatementsToAdd = $null
406412 }
407413
408414 # If we need to close the end block, and it is open,
You can’t perform that action at this time.
0 commit comments