-
-
Save SeeminglyScience/886087f84ee7462893a2bb77f6b66002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$null = if ($true) { | |
echo "this should not be visible" | |
if ($true) {return} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ScriptBlock.EndBlock | |
try | |
{ | |
try | |
{ | |
Pipe oldPipe0 = funcContext._outputPipe; | |
List<object> resultList1 = new List<object>(); | |
funcContext._outputPipe = new Pipe(resultList1); | |
oldPipe0.SetVariableListForTemporaryPipe(funcContext._outputPipe); | |
if (true) | |
{ | |
int stmt = 0; | |
unnamed_label_0: | |
try | |
{ | |
switch (stmt) | |
{ | |
case 0: | |
goto unnamed_label_1; | |
break; | |
case 1: | |
goto unnamed_label_2; | |
break; | |
case 2: | |
goto unnamed_label_3; | |
break; | |
} | |
unnamed_label_1: | |
stmt = 1; | |
PipelineOps.InvokePipeline( | |
AutomationNull.Value, | |
true, | |
new CommandParameterInternal[][] | |
{ | |
new CommandParameterInternal[] | |
{ | |
CommandParameterInternal.CreateArgument("echo", Fake.Const<StringConstantExpressionAst>("echo"), false), | |
CommandParameterInternal.CreateArgument( | |
"this should not be visible", | |
Fake.Const<StringConstantExpressionAst>(""this should not be visible""), | |
false) | |
} | |
}, | |
Fake.Const<CommandBaseAst[]>(Fake.Const<CommandBaseAst>(typeof(CommandAst), "echo "this should not be visible"")), | |
null, | |
funcContext); | |
unnamed_label_2: | |
stmt = 2; | |
if (true) | |
{ | |
try | |
{ | |
return ; | |
} | |
catch (FlowControlException) | |
{ | |
throw; | |
} | |
catch (Exception exception) | |
{ | |
ExceptionHandlingOps.CheckActionPreference(funcContext, exception); | |
} | |
} | |
} | |
catch (FlowControlException) | |
{ | |
throw; | |
} | |
catch (Exception exception) | |
{ | |
ExceptionHandlingOps.CheckActionPreference(funcContext, exception); | |
goto unnamed_label_0; | |
} | |
unnamed_label_3: | |
} | |
return PipelineOps.PipelineResult(resultList1); | |
} | |
catch (RuntimeException) | |
{ | |
PipelineOps.ClearPipe(resultList1); | |
throw; | |
} | |
finally | |
{ | |
PipelineOps.FlushPipe(oldPipe0, resultList1); | |
funcContext._outputPipe = oldPipe0; | |
} | |
} | |
catch (FlowControlException) | |
{ | |
throw; | |
} | |
catch (Exception exception) | |
{ | |
ExceptionHandlingOps.CheckActionPreference(funcContext, exception); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fixed version from https://github.com/PowerShell/PowerShell/pull/17856 | |
// ScriptBlock.EndBlock | |
try | |
{ | |
try | |
{ | |
Pipe oldPipe0 = funcContext._outputPipe; | |
List<object> resultList1 = new List<object>(); | |
funcContext._outputPipe = new Pipe(resultList1); | |
oldPipe0.SetVariableListForTemporaryPipe(funcContext._outputPipe); | |
if (true) | |
{ | |
int stmt = 0; | |
unnamed_label_0: | |
try | |
{ | |
switch (stmt) | |
{ | |
case 0: | |
goto unnamed_label_1; | |
break; | |
case 1: | |
goto unnamed_label_2; | |
break; | |
case 2: | |
goto unnamed_label_3; | |
break; | |
} | |
unnamed_label_1: | |
stmt = 1; | |
PipelineOps.InvokePipeline( | |
AutomationNull.Value, | |
true, | |
new CommandParameterInternal[][] | |
{ | |
new CommandParameterInternal[] | |
{ | |
CommandParameterInternal.CreateArgument("echo", Fake.Const<StringConstantExpressionAst>("echo"), false), | |
CommandParameterInternal.CreateArgument( | |
"this should not be visible", | |
Fake.Const<StringConstantExpressionAst>(""this should not be visible""), | |
false) | |
} | |
}, | |
Fake.Const<CommandBaseAst[]>(Fake.Const<CommandBaseAst>(typeof(CommandAst), "echo "this should not be visible"")), | |
null, | |
funcContext); | |
unnamed_label_2: | |
stmt = 2; | |
if (true) | |
{ | |
try | |
{ | |
return ; | |
} | |
catch (FlowControlException) | |
{ | |
throw; | |
} | |
catch (Exception exception) | |
{ | |
ExceptionHandlingOps.CheckActionPreference(funcContext, exception); | |
} | |
} | |
} | |
catch (FlowControlException) | |
{ | |
throw; | |
} | |
catch (Exception exception) | |
{ | |
ExceptionHandlingOps.CheckActionPreference(funcContext, exception); | |
goto unnamed_label_0; | |
} | |
unnamed_label_3: | |
} | |
return PipelineOps.PipelineResult(resultList1); | |
} | |
catch (RuntimeException) | |
{ | |
PipelineOps.ClearPipe(resultList1); | |
throw; | |
} | |
finally | |
{ | |
return funcContext._outputPipe = oldPipe0; | |
} | |
} | |
catch (FlowControlException) | |
{ | |
throw; | |
} | |
catch (Exception exception) | |
{ | |
ExceptionHandlingOps.CheckActionPreference(funcContext, exception); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment