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

Reply via email to