Scoping bug with class instance variables
Closed this issue · 1 comments
zauberparacelsus commented
With the example code below, chipmunk throws a "Y is not a local"
error, misinterpreting Y as a local when it is a class instance variable.
class testClass {
var Y
def addY(X) {
var oldY = Y
Y = Y + X
}
}
The problem line is var oldY = Y
, and if that line is replaced with the substitution below, splitting the declaration and assignment into separate lines, then the code works properly:
var oldY
oldY = Y
danielperano commented
Fixed by cb1957f.