Skip to content
Merged
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
5 changes: 3 additions & 2 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ jobs:
run: |
# HACK: auto installation uses the published version, not our local version
(cd ./main_repo/ts-parser && npm install && npm run build && npm install -g .)
OUTDIR=out_old ABCEXE=./abcoder_old ./main_repo/script/run_testdata.sh first
OUTDIR=out_old ABCEXE=./abcoder_old ./pr_repo/script/run_testdata.sh first
# avoid wasting time install a new jdtls
echo "JDTLS_ROOT_PATH=$(realpath ./main_repo/lang/java/lsp/jdtls/jdt-language-server-*)" >> $GITHUB_ENV

- name: Run OLD abcoder
run:
OUTDIR=out_old ABCEXE=./abcoder_old ./main_repo/script/run_testdata.sh all
# we run the old abcoder on the new data to compare the outputs
OUTDIR=out_old ABCEXE=./abcoder_old ./pr_repo/script/run_testdata.sh all

- name: Reset dependencies
run: |
Expand Down
19 changes: 3 additions & 16 deletions lang/golang/parser/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,6 @@ func (p *GoParser) parseSelector(ctx *fileContext, expr *ast.SelectorExpr, infos
} else if sel, ok := expr.X.(*ast.SelectorExpr); ok {
// recurse call
cont = p.parseSelector(ctx, sel, infos)
} else {
// try to get type info of field first
if ti := ctx.GetTypeInfo(expr); ti.Ty != nil {
if _, ok := ti.Ty.(*types.Signature); ok {
// collect method call
// method call
rev := ctx.GetTypeInfo(expr.X)
if !rev.IsStdOrBuiltin {
id := NewIdentity(rev.Id.ModPath, rev.Id.PkgPath, rev.Id.Name+"."+expr.Sel.Name)
dep := NewDependency(id, ctx.FileLine(expr.Sel))
infos.methodCalls = InsertDependency(infos.methodCalls, dep)
}
}
}
return true
}

// method calls
Expand Down Expand Up @@ -400,7 +385,9 @@ func (p *GoParser) parseSelector(ctx *fileContext, expr *ast.SelectorExpr, infos
}
infos.methodCalls = InsertDependency(infos.methodCalls, dep)
}
return false

// 此处应该是 true,用于处理 chained method call,让 visit 可以继续处理
return true
}

return cont
Expand Down
4 changes: 3 additions & 1 deletion lang/lsp/clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ func TestGolangLSP(t *testing.T) {

uri := NewURI(goTestCase + "/pkg/entity/entity.go")
// documentSymbol
expectedSymNames := `(MyStruct).String
expectedSymNames := `(*MyStruct).Return0
(*MyStruct).Return4
(MyStruct).String
(MyStructC).String
(MyStructD).DFunction
(MyStructD).String
Expand Down
8 changes: 8 additions & 0 deletions testdata/go/0_golang/pkg/entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ const G1 = 1
type Integer int

var V1 = Integer(1)

func (a *MyStruct) Return0() *MyStruct {
return a
}

func (a *MyStruct) Return4() string {
return a.Return0().DFunction()
}
Loading