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

feat: range over func #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ module github.com/cloudwego/goref

go 1.21

toolchain go1.22.2

require (
github.com/go-delve/delve v1.23.0
github.com/go-delve/delve v1.23.1-0.20240918211707-059f149433c1
github.com/modern-go/reflect2 v1.0.2
github.com/spf13/cobra v1.8.1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ github.com/creack/pty v1.1.20/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-delve/delve v1.23.0 h1:jYgZISZ14KAO3ys8kD07kjrowrygE9F9SIwnpz9xXys=
github.com/go-delve/delve v1.23.0/go.mod h1:S3SLuEE2mn7wipKilTvk1p9HdTMnXXElcEpiZ+VcuqU=
github.com/go-delve/delve v1.23.1-0.20240918211707-059f149433c1 h1:1pBoldThyfUh3lmUHHdQDB6IVkNgq7YUM6/J+isgGOc=
github.com/go-delve/delve v1.23.1-0.20240918211707-059f149433c1/go.mod h1:S3SLuEE2mn7wipKilTvk1p9HdTMnXXElcEpiZ+VcuqU=
github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI=
github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand Down
37 changes: 17 additions & 20 deletions pkg/proc/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,27 @@ func (scope *myEvalScope) Locals(t *proc.Target, g *proc.G, threadID int, mds []
if err != nil {
return nil, err
}
/*
if rpn := rangeParentName(scope.Fn.Name); rpn == "" {
return vars, nil
}

rangeFrames, err := rangeFuncStackTrace(t, g)
if err != nil {
return vars, nil
}
if rpn := rangeParentName(scope.Fn.Name); rpn == "" {
return vars, nil
}

rangeFrames, err := rangeFuncStackTrace(t, g)
if err != nil {
return vars, nil
}
if len(rangeFrames) > 0 {
rangeFrames = rangeFrames[2:] // skip the first frame and its return frame
enclosingRangeScopes := make([]*myEvalScope, len(rangeFrames)/2)
}

for i, scope2 := range enclosingRangeScopes {
if scope2 == nil {
scope2 := &myEvalScope{EvalScope: *proc.FrameToScope(t, t.Memory(), g, threadID, rangeFrames[2*i:]...)}
enclosingRangeScopes[i] = scope2
}
vars2, err := scope2.simpleLocals(mds)
if err != nil {
continue
}
vars = append(vars, vars2...)
for i := 0; i < len(rangeFrames)/2; i++ {
scope2 := &myEvalScope{EvalScope: *proc.FrameToScope(t, t.Memory(), g, threadID, rangeFrames[2*i:]...)}
vars2, err := scope2.simpleLocals(mds)
if err != nil {
continue
}
*/
vars = append(vars, vars2...)
}
return vars, nil
}

Expand Down
Loading