You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2019/09/11 15:55:36 UTC

[GitHub] [royale-compiler] joshtynjala edited a comment on issue #90: Bad "this"

joshtynjala edited a comment on issue #90: Bad "this"
URL: https://github.com/apache/royale-compiler/issues/90#issuecomment-530445005
 
 
   The compiler is actually working correctly, and this matches the behavior of SWF.
   
   `self` is used in the generated output only when `this` is implicit. That's why `status = "complete"` in AS3 turns into `self.status = "complete"` in JS. However, if you had `this.status = "complete"` instead, the explicit `this` in AS3 would not be replaced by `self` in the generated JS output. You'd get `this.status = "complete"` in JS too.
   
   Similarly, `complete(this)` in AS3 turns into `self.complete(this)` in JS. The first `this` in AS3 is implicit, so it the JS gets `self`, and the second `this` in AS3 is explicit, so it remains as `this` in JS.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services