File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ function Join-PipeScript
294294 # (don't forget to trim leading whitespace)
295295 } else {
296296 # for every other parameter it is the content between parameters.
297- $lastParameter = $parameter.Parent.Parameters [$parameterIndex - 1 ]
297+ $lastParameter = $parameter.Parent.Parameters [$parameterIndex - 1 ]
298298 $relativeOffset = $lastParameter.Extent.EndOffset + 1 - $parameter.Parent.Extent.StartOffset
299299 $distance = $parameter.Extent.StartOffset - $lastParameter.Extent.EndOffset - 1
300300 # (don't forget to trim leading whitespace and commas)
@@ -427,6 +427,13 @@ function Join-PipeScript
427427 # endregion Joining the Scripts
428428
429429 $combinedScriptBlock = [scriptblock ]::Create($joinedScript )
430+ if ((-not $combinedScriptBlock.Ast.EndBlock.Unnamed ) -and -not (
431+ $combinedScriptBlock.Ast.ProcessBlock -or
432+ $combinedScriptBlock.Ast.BeginBlock -or
433+ $combinedScriptBlock.Ast.DynamicParameterBlock
434+ )) {
435+ $combinedScriptBlock = [ScriptBlock ]::Create($combinedScriptBlock.Ast.EndBlock.ToString () -replace ' ^end\s{0,}\{' -replace ' \}$' )
436+ }
430437 if ($combinedScriptBlock -and $Transpile ) {
431438 $combinedScriptBlock | .> Pipescript
432439 } elseif ($combinedScriptBlock ) {
You can’t perform that action at this time.
0 commit comments