Netjs icon indicating copy to clipboard operation
Netjs copied to clipboard

"this" loses context when calling a function assigned to a variable.

Open ZaneDubya opened this issue 9 years ago • 0 comments

    Func<List<string>, OpcodeFlag, ParserState, List<ushort>> assembler;
    assembler = m_Opcodes[opcode.ToLowerInvariant()];
    bool result = assembler(param, opcodeFlag, state);

After transpilation to typescript, any calls to "this." in the assigned "assembler" function will resolve to Window, not the calling class. I believe this is the same problem seen in this thread on Stack Overflow. If I knew more about javascript, I'd propose a fix for you - but I don't, so all I can offer is this issue.

ZaneDubya avatar Jun 23 '15 02:06 ZaneDubya