@@ -27,7 +27,6 @@ import (
2727
2828 sitter "github.com/smacker/go-tree-sitter"
2929
30- "github.com/cloudwego/abcoder/lang/cpp"
3130 "github.com/cloudwego/abcoder/lang/cxx"
3231 "github.com/cloudwego/abcoder/lang/java"
3332 javaipc "github.com/cloudwego/abcoder/lang/java/ipc"
@@ -114,8 +113,6 @@ func switchSpec(l uniast.Language, repo string) LanguageSpec {
114113 return python .NewPythonSpec ()
115114 case uniast .Java :
116115 return java .NewJavaSpec (repo )
117- case uniast .Cpp :
118- return cpp .NewCppSpec ()
119116 default :
120117 panic (fmt .Sprintf ("unsupported language %s" , l ))
121118 }
@@ -1701,11 +1698,9 @@ func (c *Collector) getSymbolByLocation(ctx context.Context, loc Location, depth
17011698 // return sym, nil
17021699 // }
17031700
1704- if ! (from .Type == "typeParameter" && c .Language == uniast .Cpp ) {
1705- // 1. already loaded
1706- if sym := c .findMatchingSymbolIn (loc , slices .Collect (maps .Values (c .syms ))); sym != nil {
1707- return sym , nil
1708- }
1701+ // 1. already loaded
1702+ if sym := c .findMatchingSymbolIn (loc , slices .Collect (maps .Values (c .syms ))); sym != nil {
1703+ return sym , nil
17091704 }
17101705
17111706 if c .LoadExternalSymbol && ! c .internal (loc ) && (c .NeedStdSymbol || ! c .spec .IsStdToken (from )) {
@@ -1934,11 +1929,11 @@ func (c *Collector) processSymbol(ctx context.Context, sym *DocumentSymbol, dept
19341929
19351930 // function info: type params, inputs, outputs, receiver (if !needImpl)
19361931 if sym .Kind == SKFunction || sym .Kind == SKMethod {
1937- var rd * dependency
1932+ var rsym * dependency
19381933 rec , tps , ips , ops := c .spec .FunctionSymbol (* sym )
1939- if (! hasImpl || c .Language == uniast .Cpp ) && rec >= 0 {
1934+
1935+ if ! hasImpl && rec >= 0 {
19401936 rsym , err := c .getSymbolByTokenWithLimit (ctx , sym .Tokens [rec ], depth )
1941- rd = & dependency {sym .Tokens [rec ].Location , rsym }
19421937 if err != nil || rsym == nil {
19431938 log .Error ("get receiver symbol for token %v failed: %v\n " , rec , err )
19441939 }
@@ -1947,18 +1942,6 @@ func (c *Collector) processSymbol(ctx context.Context, sym *DocumentSymbol, dept
19471942 ipsyms , is := c .getDepsWithLimit (ctx , sym , ips , depth - 1 )
19481943 opsyms , os := c .getDepsWithLimit (ctx , sym , ops , depth - 1 )
19491944
1950- // filter tsym is type parameter
1951- if c .Language == uniast .Cpp {
1952- tsFiltered := make ([]dependency , 0 , len (ts ))
1953- for _ , d := range ts {
1954- if d .Symbol == nil || d .Symbol .Kind == SKTypeParameter {
1955- continue
1956- }
1957- tsFiltered = append (tsFiltered , d )
1958- }
1959- ts = tsFiltered
1960- }
1961-
19621945 //get last token of params for get signature
19631946 lastToken := rec
19641947 for _ , t := range tps {
@@ -1977,28 +1960,18 @@ func (c *Collector) processSymbol(ctx context.Context, sym *DocumentSymbol, dept
19771960 }
19781961 }
19791962
1980- c .updateFunctionInfo (sym , tsyms , ipsyms , opsyms , ts , is , os , rd , lastToken )
1963+ c .updateFunctionInfo (sym , tsyms , ipsyms , opsyms , ts , is , os , rsym , lastToken )
19811964 }
19821965
19831966 // variable info: type
19841967 if sym .Kind == SKVariable || sym .Kind == SKConstant {
19851968 i := c .spec .DeclareTokenOfSymbol (* sym )
1986- // in cpp, it should search form behind to front to find the first entity token
19871969 // find first entity token
1988- if c .Language == uniast .Cpp {
1989- for i = i - 1 ; i >= 0 ; i -- {
1990- if c .spec .IsEntityToken (sym .Tokens [i ]) {
1991- break
1992- }
1993- }
1994- } else {
1995- for i = i + 1 ; i < len (sym .Tokens ); i ++ {
1996- if c .spec .IsEntityToken (sym .Tokens [i ]) {
1997- break
1998- }
1970+ for i = i + 1 ; i < len (sym .Tokens ); i ++ {
1971+ if c .spec .IsEntityToken (sym .Tokens [i ]) {
1972+ break
19991973 }
20001974 }
2001-
20021975 if i < 0 || i >= len (sym .Tokens ) {
20031976 log .Error ("get type token of variable symbol %s failed\n " , sym )
20041977 return
0 commit comments