Sometimes a .wrapped wrapper requires access to context data, e.g. in order to decrypt a payload, one would need the decryption key. Thus the wrapper function should be able to access this (as it's current context) similar to how e.g. formatters are able to access the current context.
I am not deeply familiar with the code generation part, however as far as I can judge, the "this" refrence in the generateWrapper code:
ctx.pushCode(
`${wrappedBuf} = ${func}.call(this, ${wrappedBuf}).subarray(0);`,
);
Doesn't make any sense, as this is the global scope and should be changed to:
ctx.pushCode(
`${wrappedBuf} = ${func}.call(${ctx.generateVariable()}, ${wrappedBuf}).subarray(0);`,
);
As for other calls to imports.
Sometimes a
.wrappedwrapper requires access to context data, e.g. in order to decrypt a payload, one would need the decryption key. Thus thewrapperfunction should be able to accessthis(as it's current context) similar to how e.g.formatters are able to access the current context.I am not deeply familiar with the code generation part, however as far as I can judge, the "this" refrence in the
generateWrappercode:Doesn't make any sense, as
thisis the global scope and should be changed to:As for other calls to imports.