Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack #1

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Stack #1

wants to merge 20 commits into from

Conversation

breadchris
Copy link

No description provided.

bailsman and others added 20 commits December 31, 2021 23:16
By placing a handle value on several strategic calls in the runtime
we can then later parse a runtime stacktrace, look for the magic
values in function parameters, and reconstruct the calling nodes.

We can use that to filter out all the yaegi runtime calls and
present the user with a stacktrace that includes only interpreted
frames.
this makes the filtered stack look identical to the regular go stacktrace
this allows calling code to interchange both types
interpreter may be entered (for example) from genFunctionWrapper
When a panic happens, we want to get the stack trace from the oldest
panic, before runCfg unwinds everything.

However, at that point we don't know yet whether we will be recovered.
As a silly kludge, currently storing the oldest panic in a list on the
Interpreter struct which can then be queried once we're ready.

The approach taken is not strictly correct: if a panic is recovered, and
never queried, and later the same error occurs again and then is not
recovered, the wrong call stack will be returned.
…ic_test.go with additional test cases. hopefully that's the end of it..
… wrappers

A side effect of traefik#1281 is that it added unnecessary additional newlines in generated interface wrappers from the `extract` tool. This PR removes those newlines from the extract tool template and updates the generated code with that change.
Follow by the [Spec](https://go.dev/ref/spec#Assignment_statements):

The number of operands on the left hand side must match the number of values. For instance, if f is a function returning two values `x, y = f()` assigns the first value to x and the second to y.

In the second form, the number of operands on the left must equal the number of expressions on the right, each of which must be single-valued, and the nth expression on the right is assigned to the nth operand on the left.

Fixes traefik#1606
…nction

This fixes issue traefik#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 traefik#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() ..
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.

6 participants