Created
December 2, 2019 16:17
-
-
Save controlflow/0d7231612d3c8c531d178730476a4070 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
[NotNull, Pure] | |
public static IPattern UnwrapFromSandbox([NotNull] this IPattern pattern) | |
{ | |
if (pattern.Parent is ISandBox sandBox | |
&& sandBox.ContextType == SandBoxContextType.Replace | |
&& sandBox.ContextNode is IPattern replacedPattern) | |
{ | |
return replacedPattern; | |
} | |
return pattern; | |
} |
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
[NotNull, Pure] | |
public static IPattern UnwrapFromSandbox([NotNull] this IPattern pattern) | |
{ | |
if (pattern.Parent is ISandBox { | |
ContextType: SandBoxContextType.Replace, | |
ContextNode: IPattern replacedPattern }) | |
{ | |
return replacedPattern; | |
} | |
return pattern; | |
} |
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
[NotNull, Pure] | |
public static IPattern UnwrapFromSandbox([NotNull] this IPattern pattern) | |
{ | |
if (pattern is { | |
Parent: ISandBox { | |
ContextType: SandBoxContextType.Replace, | |
ContextNode: IPattern replacedPattern } }) | |
{ | |
return replacedPattern; | |
} | |
return pattern; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment