When parsing def p(), we'll find the x in the body and assign it as an input, since at that point, we haven't seen that the user is declaring an x.
There are a couple of options here, one could be to put inputs inside function definitions in stage mode and determine whether they're inputs or not depending on whether the variable exists when they're first called.
Another alternative is to raise an error, perform the refactoring by adding x to the signature, modify the instances where the function is called and then starting again. See #12
GIven the snippet:
When parsing
def p()
, we'll find thex
in the body and assign it as an input, since at that point, we haven't seen that the user is declaring anx
.There are a couple of options here, one could be to put inputs inside function definitions in
stage
mode and determine whether they're inputs or not depending on whether the variable exists when they're first called.Another alternative is to raise an error, perform the refactoring by adding x to the signature, modify the instances where the function is called and then starting again. See #12
I think the latter is a better option.