Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setter function issue #188

Open
peteshand opened this issue Sep 19, 2013 · 3 comments
Open

setter function issue #188

peteshand opened this issue Sep 19, 2013 · 3 comments

Comments

@peteshand
Copy link

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
Copy link
Member

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
Copy link
Author

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants