Hey @BlakeMScurr
For methods without for loops, you can get methodsWithFor and also all methods and then do a not like below.
{
recurse (func: eq(kind, "csharp.for_statement")) {
methodsWithFor as ~child @filter(eq(kind, "charp.method_declaration"))
}
methods_without_for(func: eq(kind, "csharp.method_declaration")) @filter(not uid(methodsWithFor)) {
identifier_token
kind
}
}
Similarly for loops that aren’t in methods - Subtract for loops that are in a method from all the for loops.
{
recurse (func: eq(kind, "csharp.method_declaration")) {
forLoopInMethod as child @filter(eq(kind, "csharp.for_statement"))
}
forLoopNotInMethods(func: eq(kind, "csharp.for_statement")) @filter(not uid(forLoopInMethod)) {
kind
identifier_token
}
}