RandoriAS / randori-compiler

Compiler for Randori ActionScript Project
http://randoriframework.com/
20 stars 9 forks source link

setter function issue #188

Open peteshand opened 11 years ago

peteshand commented 11 years ago

If multiple = are used on a single line with setter functions only the last setter is set correctly.

Actionscript:

private var _test:String = ""; private var _test2:String = "";

public function DoubleTest() { test = test2 = 'test123'; Window.console.log(_test); // Output undefined Window.console.log(_test2); // Output 'test123' }

public function set test2(value:String):void { _test2 = value; }

public function set test(value:String):void { _test = value; }

Javascript:

test.DoubleTest = function() { this._test = ""; this._test2 = ""; this.set_test(this.set_test2("test123")); console.log(this._test); // Output undefined console.log(this._test2); // Output 'test123' };

test.DoubleTest.prototype.set_test2 = function(value) { this._test2 = value; };

test.DoubleTest.prototype.set_test = function(value) { this._test = value; };

rolandzwaga commented 11 years ago

Hi there, thanks for the report. Currently we don't have anyone working on the compiler, so I can't tell you when this will be fixed. For now, put the assignments on separate lines to work around this.

peteshand commented 11 years ago

Yep, doesn't look like there is much activity. Yeah I've just split everything onto separate lines for the time being, but thought it would be good to list the issue here, either for the next person that encounters the problem, or so someone fixes it next time they're working on the compiler... unfortunately there seems to be quite a few weird edge cases that trip Randori up.

rolandzwaga commented 11 years ago

Indeed, whenever you find an issue, please keep posting them here. We're aware of a lot of edge cases, the problem is that Randori needs to support IE8 (enterprises still use it a lot), therefore we need to generate this getter and setter functions, instead of using the Object.createProperty() method. So, in the end, I'm not sure if we can support every edge case out there, I'm afraid we'll have to resort to workarounds in some cases.