Closed SubhamPramanik closed 1 month ago
I was not able to reproduce the above, however I ran into a similar issue, when the inner function has parameters: This is ok (indexing works):
# OK
def outer():
def inner():
pass
But this isn't:
# KO
def outer():
def inner(x):
pass
(notice the added x parameter to inner)
stacktrace:
[...]/repro.py: failed to build stack graph
0: Error executing statement edge @param.def -> @param.class_self_scope at (799, 3)
src/stack-graphs.tsg:799:3:
799 | edge @param.def -> @param.class_self_scope
| ^
in stanza
src/stack-graphs.tsg:794:1:
794 | (function_definition
| ^
matching (function_definition) node
[...]/repro.py:2:5:
2 | def inner(x):
| ^
1: Evaluating edge sink
2: Expected a graph node reference got #null
Error: failed to build stack graph
Failing stanza:
(function_definition
parameters: (parameters
. (identifier) @param)
body: (block) @body)
{
edge @param.def -> @param.class_self_scope
edge @param.class_member_attr_scope -> @param.output
edge @param.output -> @body.after_scope
attr (@param.output) push_node = @param
}
I believe @param.class_self_scope is unset in this situation
Edit: fyi I'm working on a fix, I will open a PR soon
Python Code:
Failing Stanza: