Created
October 25, 2016 14:30
-
-
Save controlflow/5339934fbd1629437a933352c5f6ca63 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
| public override bool Match(ITreeNode element, IMatchingContext context) | |
| { | |
| if (element == null) | |
| return false; | |
| if (element is ICSharpArgument arg) | |
| element = arg.Value; | |
| if (element is IExpressionInitializer exprInitializer) | |
| element = exprInitializer.Value; | |
| if (element is IAnonymousMemberDeclaration declaration) | |
| { | |
| if (!declaration.IsProjectionInitializer) return false; | |
| element = declaration.Expression; | |
| } | |
| if (element is ILambdaParameterDeclaration lambda) | |
| element = lambda.NameIdentifier; | |
| if (element is IFieldDeclaration fieldDecl) | |
| element = fieldDecl.NameIdentifier; | |
| if (element is IEventDeclaration eventDecl) | |
| element = eventDecl.NameIdentifier; | |
| if (element is IQueryRangeVariableDeclaration rangeVar) | |
| element = rangeVar.NameIdentifier; | |
| if (element is ICatchVariableDeclaration catchVar) | |
| element = catchVar.NameIdentifier; | |
| ... | |
| } |
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
| public override bool Match(ITreeNode element, IMatchingContext context) | |
| { | |
| if (element == null) | |
| return false; | |
| if (element is ICSharpArgument) | |
| element = ((ICSharpArgument)element).Value; | |
| if (element is IExpressionInitializer) | |
| element = ((IExpressionInitializer)element).Value; | |
| if (element is IAnonymousMemberDeclaration) | |
| { | |
| var declaration = (IAnonymousMemberDeclaration)element; | |
| if (!declaration.IsProjectionInitializer) return false; | |
| element = declaration.Expression; | |
| } | |
| if (element is ILambdaParameterDeclaration) | |
| element = ((ILambdaParameterDeclaration) element).NameIdentifier; | |
| if (element is IFieldDeclaration) | |
| element = ((IFieldDeclaration) element).NameIdentifier; | |
| if (element is IEventDeclaration) | |
| element = ((IEventDeclaration) element).NameIdentifier; | |
| if (element is IQueryRangeVariableDeclaration) | |
| element = ((IQueryRangeVariableDeclaration) element).NameIdentifier; | |
| if (element is ICatchVariableDeclaration) | |
| element = ((ICatchVariableDeclaration) element).NameIdentifier; | |
| ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment