Skip to content

Instantly share code, notes, and snippets.

@controlflow
Created November 13, 2019 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save controlflow/4b749f34c35e240e03f7a8f33afe3a15 to your computer and use it in GitHub Desktop.
Save controlflow/4b749f34c35e240e03f7a8f33afe3a15 to your computer and use it in GitHub Desktop.
switch (myJumpStatement)
{
case IReturnStatement returnStatement when returnStatement.Value != null:
ReplaceWithValue(returnStatement, returnStatement.Value);
break;
case IYieldStatement yieldStatement when yieldStatement.Expression != null:
ReplaceWithValue(yieldStatement, yieldStatement.Value);
break;
default:
myJumpStatement.RemoveOrReplaceByEmptyStatement();
break;
}
switch (myJumpStatement)
{
case IReturnStatement { Value: { } value } returnStatement:
ReplaceWithValue(returnStatement, value);
break;
case IYieldStatement { Expression: { } value } yieldStatement:
ReplaceWithValue(yieldStatement, value);
break;
default:
myJumpStatement.RemoveOrReplaceByEmptyStatement();
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment