An additional related problem: Using “call” with a different “this” will not work with the aliased functions either.
This is proving to be a challenge for me… Harbs > On Jun 17, 2018, at 12:02 PM, Harbs <[email protected]> wrote: > > I have the following class: > https://paste.apache.org/r7Ek <https://paste.apache.org/r7Ek> > > Which gets cross-compiled to: > https://paste.apache.org/3k1r <https://paste.apache.org/3k1r> > > The problem is here: > struct.process = function():void { > if (this.version === 0) { > for (var i:int = 0; i < this.offsets.length; i++) { > this.offsets[i] <<= 1; > } > } > }; > > In this case, “this” refers to the “struct” VersionedStruct instance. (At > least in Javascript. Am I correct in assuming that’s the case in ActionScript > as well?) > > However, it gets cross-compiled to the following where “this" is the global > this: > > var /** @type {Function} */ __localFn0__ = function() { > if (this.version === 0) { > for (var /** @type {number} */ i = 0; i < this.offsets.length; i++) { > this.offsets[i] <<= 1; > } > } > } > com.printui.fontkit.tables.loca.struct.process = __localFn0__; > > What is the purpose of pulling the inline function out? > > Harbs
