Created
May 2, 2021 15:30
-
-
Save sgaliamov/1120fe9f2e939da470e681ff0da5f1bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| namespace CustomExtensions | |
| { | |
| public static class Functions | |
| { | |
| public static ILEmitterFunc If( | |
| ILEmitterFunc condition, | |
| ILEmitterFunc then, | |
| ILEmitterFunc @else) => (in ILEmitter il) => | |
| il.Brfalse(condition, out var otherwise) | |
| .Emit(then) | |
| .Br(out var end) | |
| .MarkLabel(otherwise) | |
| .Emit(@else) | |
| .MarkLabel(end); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment