Hedy is a gradual programming language to teach children programming. Gradual languages use different language levels, where each level adds new concepts and syntactic complexity. At the end of the Hedy level sequence, kids master a subset of syntactically valid Python.
Describe the bug
In some cases a command could consider an argument either as a variable, if such is defined, or a literal string. If a variable is defined and if is accessed before its definition, an error is raised. The access-before-definition check uses only line numbers. As a result, the following snippet produces an error while it should not.
Paste the Hedy code & level
Level 12:
define turn
if x is pressed
print 'good'
else
print 'bad'
print 'Start'
call turn
x is 1 + 1
print x
print 'End'
The access-before-definition check should take into account that functions use another scope.
Describe the bug In some cases a command could consider an argument either as a variable, if such is defined, or a literal string. If a variable is defined and if is accessed before its definition, an error is raised. The access-before-definition check uses only line numbers. As a result, the following snippet produces an error while it should not.
Paste the Hedy code & level Level 12:
The access-before-definition check should take into account that functions use another scope.