But, this isn't valid Python, so the fix is not to make the scope.isUserFunction() call more comprehensive. Instead, we need to throw a nice Python-like error as show below. This would probably be a runtime check of some sort.
print(foo()) # foo not defined yet
def foo():
return 5
10:19:02:/tmp$ python test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
print(foo())
NameError: name 'foo' is not defined
This can break in a weird way for some scenarios (null param) currently, because
createParamsObj
is not applied to user functions that haven't been defined yet: https://github.com/differentmatt/filbert/blob/master/filbert.js#L2178But, this isn't valid Python, so the fix is not to make the
scope.isUserFunction()
call more comprehensive. Instead, we need to throw a nice Python-like error as show below. This would probably be a runtime check of some sort.Related issue: https://github.com/codecombat/codecombat/issues/2073