Skip to content
Merged
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
25 changes: 19 additions & 6 deletions lang/collect/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,18 +417,31 @@ func (c *Collector) exportSymbol(repo *uniast.Repository, symbol *DocumentSymbol
switch k := symbol.Kind; k {
// Function
case SKFunction, SKMethod:
info := c.funcs[symbol]
// Detect interface-method via LSP parent first (cli.files populated).
// Java IPC mode does not populate cli.files, so fall back to the
// receiver symbol kind recorded by the scanner.
isInterfaceMethod := false
if c.cli != nil {
if p := c.cli.GetParent(symbol); p != nil && p.Kind == SKInterface {
// NOTICE: no need collect interface method
break
isInterfaceMethod = true
}
}
if isInterfaceMethod {
// NOTICE: no need collect interface method for non-Java langs.
// Java still collects it but flags IsInterfaceMethod.
break
}
if info.Method != nil && info.Method.Receiver.Symbol != nil &&
info.Method.Receiver.Symbol.Kind == SKInterface {
isInterfaceMethod = true
}
obj := &uniast.Function{
FileLine: fileLine,
Content: content,
Exported: public,
FileLine: fileLine,
Content: content,
Exported: public,
IsInterfaceMethod: isInterfaceMethod,
}
info := c.funcs[symbol]
obj.Signature = info.Signature
// NOTICE: type parames collect into types
if info.TypeParams != nil {
Expand Down
Loading