fix(go): continue parsing chained selector method calls#184
Merged
Hoblovski merged 1 commit intocloudwego:mainfrom Apr 22, 2026
Merged
fix(go): continue parsing chained selector method calls#184Hoblovski merged 1 commit intocloudwego:mainfrom
Hoblovski merged 1 commit intocloudwego:mainfrom
Conversation
welkeyever
reviewed
Apr 21, 2026
| fmt.Fprintf(os.Stderr, "failed to get refer code for %s: %v\n", id.Name, err) | ||
| } | ||
| if id.Name == "MyStructD.DFunction" { | ||
| fmt.Println(1) |
Collaborator
|
可以给 testdata/ 加一个测例吗?期望的行为就是回归测试挂掉,因为你改了 Go parser。 |
10c941e to
5c56636
Compare
Allow selector traversal to keep visiting chained method calls instead of returning early, so downstream calls can still be collected during Go parsing.
Collaborator
Author
|
done
|
Hoblovski
approved these changes
Apr 22, 2026
| if err := p.referCodes(ctx, &id, p.opts.ReferCodeDepth); err != nil { | ||
| fmt.Fprintf(os.Stderr, "failed to get refer code for %s: %v\n", id.Name, err) | ||
| } | ||
| if id.Name == "MyStructD.DFunction" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow selector traversal to keep visiting chained method calls instead of returning early, so downstream calls can still be collected during Go parsing.
What type of PR is this?
fix
Check the PR title.
(Optional) Translate the PR title into Chinese.
修复:golang 链式调用中,无法正确解析 Function Recv 的问题
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
zh(optional):
在下面这样的代码中
AFunction 的 NodeID Name 会被解析成
E.AFunction而不是A.AFunction测试中,
Return4的MethodCalls中DFunction应该是:{ "ModPath": "a.b/c", "PkgPath": "a.b/c/pkg/entity", "Name": "MyStructD.DFunction", "File": "pkg/entity/entity.go", "Line": 78, "StartOffset": 1458, "EndOffset": 1465, "Extra": { "IsInvoked": true } }原来的代码中,会返回:
{ "ModPath": "a.b/c", "PkgPath": "a.b/c/pkg/entity", "Name": "MyStruct.DFunction", "File": "pkg/entity/entity.go", "Line": 78, "StartOffset": 1458, "EndOffset": 1465, "Extra": { "IsInvoked": true } }(Optional) Which issue(s) this PR fixes:
(optional) The PR that updates user documentation: