Test example bad\unused_decl.zig causes stack overflow due to recursion having infinite loop.
It goes to:
checkNamespace( container_decl_two ...)
→ checkNamespaceItem (fn_decl...)
→ checkNamespaceItem (fn_proto...)
→ searchForNameInNamespace
→ checkValueForName(simple_var_decl...)
where for init node we have container_decl_two
which calls checkNamespace and it repeats.
Can be fixed by just removing:
.container_decl, .container_decl_trailing => {
const x = ast.containerDecl(node);
if (try checkValuesForName(ast, search_name, x.ast.members, writer, file_name, node)) return true;
- try checkNamespace(ast, node, writer, file_name);
return false;
},
But probably larger refactor would be needed to make it more performant/safer.
Test example
bad\unused_decl.zigcauses stack overflow due to recursion having infinite loop.It goes to:
where for init node we have
container_decl_twowhich calls
checkNamespaceand it repeats.Can be fixed by just removing:
But probably larger refactor would be needed to make it more performant/safer.