joshtynjala commented on issue #210:
URL: 
https://github.com/apache/royale-compiler/issues/210#issuecomment-1054550835


   I suspect this applies to any getter/setter property, and not only ones 
accessed using `super`.
   
   This seems to be how the JS code is generated:
   
   ```js
   this.com_example_MyClass_something = 
com.example.MyClass.superClass_.set__mySetter.apply(this, [ value] );
   ```
   
   It fails because the setter doesn't return anything. So I think that 
`undefined` would be assigned to `something`, instead of the value.
   
   The generated JS should probably be something like this instead:
   
   ```js
   com.example.MyClass.superClass_.set__mySetter.apply(this, [ value] )
   this.com_example_MyClass_something = 
com.example.MyClass.superClass_.get__mySetter.apply(this);
   ```
   
   However, I think that will be tricky to generate because I'm pretty sure 
that the emitter writes multiple assignments without looking ahead, and 
`this.com_example_MyClass_something` will already be be emitted before we even 
detect that there's a setter involved.
   
   It might not look pretty, but I think that we can use the [comma 
operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comma_Operator)
 to make this work. Probably safest with parentheses around the full expression.
   
   ```js
   this.com_example_MyClass_something = 
(com.example.MyClass.superClass_.set__mySetter.apply(this, [ value]), 
com.example.MyClass.superClass_.get__mySetter.apply(this));
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to