Last active
January 26, 2017 14:14
-
-
Save controlflow/be9325e1bf8add8bd0d33ac06e5e70bd 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] | |
| private static bool HasContainingUnclosedBlocks([NotNull] ILocalFunctionDeclaration localFunctionDeclaration) | |
| { | |
| foreach (var containingNode in localFunctionDeclaration.ContainingNodes()) | |
| { | |
| var containingBlock = containingNode as IBlock; | |
| if (containingBlock != null && containingBlock.RBrace == null) return true; | |
| var switchBlock = containingNode as ISwitchBlock; | |
| if (switchBlock != null && switchBlock.RBrace == null) return true; | |
| var classBody = containingNode as IClassBody; | |
| if (classBody != null && classBody.RBrace == null) return true; | |
| var namespaceBody = containingNode as INamespaceBody; | |
| if (namespaceBody != null && namespaceBody.RBrace == null) return true; | |
| } | |
| return false; | |
| } |
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] | |
| private static bool HasContainingUnclosedBlocks([NotNull] ILocalFunctionDeclaration localFunctionDeclaration) | |
| { | |
| foreach (var containingNode in localFunctionDeclaration.ContainingNodes()) | |
| { | |
| switch (containingNode) | |
| { | |
| case IBlock block when block.RBrace == null: | |
| case ISwitchBlock switchBlock when switchBlock.RBrace == null: | |
| case IClassBody classBody when classBody.RBrace == null: | |
| case INamespaceBody namespaceBody when namespaceBody.RBrace == null: | |
| return true; | |
| } | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment