Created
March 6, 2019 12:41
-
-
Save controlflow/69a677cf6aaa5e6a997afe43f34eb954 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
[Pure] | |
public static bool CanRemoveDesignation([NotNull] this IRecursivePattern recursivePattern) | |
{ | |
if (recursivePattern.TypeUsage == null && recursivePattern.PropertyPatternClause == null) | |
{ | |
var deconstructionPatternClause = recursivePattern.DeconstructionPatternClause; | |
if (deconstructionPatternClause != null) | |
{ | |
if (deconstructionPatternClause.Patterns.Count == 1) return false; | |
} | |
} | |
return !recursivePattern.ContainsPreprocessorDirectiveChildren(); | |
} |
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
[Pure] | |
public static bool CanRemoveDesignation([NotNull] this IRecursivePattern recursivePattern) | |
{ | |
if (recursivePattern is { | |
TypeUsage: null, | |
PropertyPatternClause: null, | |
DeconstructionPatternClause: { Patterns: { Count: 1 } } | |
}) | |
{ | |
return false; | |
} | |
return !recursivePattern.ContainsPreprocessorDirectiveChildren(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment