MyWorldLLC/Chipmunk

Scoping bug with class instance variables

Closed this issue · 1 comments

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

Fixed by cb1957f.