traefik / yaegi

Yaegi is Another Elegant Go Interpreter
https://pkg.go.dev/github.com/traefik/yaegi
Apache License 2.0
6.94k stars 343 forks source link

fix for issue #1634 -- for passing a closure to exported Go function #1646

Closed rcoreilly closed 1 month ago

rcoreilly commented 1 month ago

This fixes issue #1634

includes special case for defer function.

I could remove or significantly reduce the comment description, and just have that here for future reference:

// per #1634, if v is already a func, then don't re-wrap! critically, the original wrapping // clones the frame, whereas the one here (below) does not clone the frame, so it doesn't // generate the proper closure capture effects! // this path is the same as genValueAsFunctionWrapper which is the path taken above if // the value has an associated node, which happens when you do f := func() ..

traefiker commented 1 month ago

:no_entry_sign: failed to update: update branch: PUT https://api.github.com/repos/traefik/yaegi/pulls/1646/update-branch: 403 user doesn't have permission to update head repository []

mvertes commented 1 month ago

@rcoreilly if it is ok for you, allowing 'edit by maintainers' on next pull requests would permit us to better automate rebase at merge (when no conflicts) and manage not up-to-date branches.

In the meantime, you have to update the branch yourself, so we can proceed.

Thanks