From b3aae0df4a2131268a94ab6cca82bee8397a2c56 Mon Sep 17 00:00:00 2001 From: jupblb Date: Wed, 22 Apr 2026 12:21:52 +0200 Subject: [PATCH] visitors: remove unused pkgLookup from fileVisitor The allPackages map was passed to NewFileVisitor but never read from the struct field. Removing it simplifies the API and eliminates an unnecessary reference from each visitor instance. --- internal/index/scip.go | 1 - internal/visitors/visitor_file.go | 6 ------ 2 files changed, 7 deletions(-) diff --git a/internal/index/scip.go b/internal/index/scip.go index 8579fae..3154dda 100644 --- a/internal/index/scip.go +++ b/internal/index/scip.go @@ -141,7 +141,6 @@ func Index(writer func(proto.Message) error, opts config.IndexOpts) error { doc, pkg, file, - allPackages, pkgSymbols, globalSymbols, ) diff --git a/internal/visitors/visitor_file.go b/internal/visitors/visitor_file.go index bf5958b..08c440a 100644 --- a/internal/visitors/visitor_file.go +++ b/internal/visitors/visitor_file.go @@ -8,7 +8,6 @@ import ( "log/slog" "github.com/scip-code/scip-go/internal/document" - "github.com/scip-code/scip-go/internal/loader" "github.com/scip-code/scip-go/internal/lookup" "github.com/scip-code/scip-go/internal/newtypes" "github.com/scip-code/scip-go/internal/symbols" @@ -20,7 +19,6 @@ func NewFileVisitor( doc *document.Document, pkg *packages.Package, file *ast.File, - pkgLookup loader.PackageLookup, pkgSymbols *lookup.Package, globalSymbols *lookup.Global, ) *fileVisitor { @@ -40,7 +38,6 @@ func NewFileVisitor( doc: doc, pkg: pkg, file: file, - pkgLookup: pkgLookup, locals: map[token.Pos]lookup.Local{}, pkgSymbols: pkgSymbols, globalSymbols: globalSymbols, @@ -61,9 +58,6 @@ type fileVisitor struct { pkg *packages.Package file *ast.File - // soething - pkgLookup loader.PackageLookup - // local definition position to symbol and its type information locals map[token.Pos]lookup.Local