Skip to content

Conversation

cputnam-a11y
Copy link

Fixes #178

@cputnam-a11y
Copy link
Author

oh hey, it failed check style

@@ -217,7 +217,7 @@ private class Callback extends InsnList {
this.invoke.add().add(handlerArgs);

//If the handler doesn't captureArgs, the CallbackInfo(Returnable) will be the first LVT slot, otherwise it will be at the target's frameSize
int callbackInfoSlot = handlerArgs.length == 1 ? Bytecode.isStatic(handler) ? 0 : 1 : frameSize;
int callbackInfoSlot = Bytecode.getFirstNonArgLocalIndex(handler) - 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work when extraArgs > 0, you'd need to subtract Bytecode.getArgsSize(handlerArgs, target.arguments.length + 1, handlerArgs.length) to account for the captured locals following the callback.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Makes sense

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had thought about M.E. locals, but didn't really consider LocalCapture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nullable CallbackInfo optimization does not properly consider static handlers in instance target methods
3 participants