I found an issue in the JavaScript generator. If you have following class:
class Simple { Int v { set { if (it < 0) it = 0; &v = it; } } }
And then try to use it:
s := Simple() s.v += 5
You will get Uncaught ReferenceError: Invalid left-hand side in assignment exception. The problem in the generated JavaScript:
Uncaught ReferenceError: Invalid left-hand side in assignment
var s = fan.hello.Simple.make(); s.v() = fan.sys.Int.plus(s.v(),5);
Note: without overridden set it works fine.
set
I believe this is actually a bug in the shortcut assignment generation: #1387
If so, then this should work:
s := Simple s.v = s.v + 5
Yep, this is exactly my issue and I've used such workaround. OK, waiting for the fix.
Login or Signup to reply.
Yuri Strot Sun 20 Mar 2011
I found an issue in the JavaScript generator. If you have following class:
And then try to use it:
You will get
Uncaught ReferenceError: Invalid left-hand side in assignment
exception. The problem in the generated JavaScript:Note: without overridden
set
it works fine.andy Mon 21 Mar 2011
I believe this is actually a bug in the shortcut assignment generation: #1387
If so, then this should work:
Yuri Strot Mon 21 Mar 2011
Yep, this is exactly my issue and I've used such workaround. OK, waiting for the fix.