forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
46 lines (38 loc) · 1.3 KB
/
types.go
File metadata and controls
46 lines (38 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package codenav
import (
"strings"
"github.com/sourcegraph/sourcegraph/internal/codeintel/shared/types"
"github.com/sourcegraph/sourcegraph/lib/codeintel/precise"
)
// visibleUpload pairs an upload visible from the current target commit with the
// current target path and position matched to the data within the underlying index.
type visibleUpload struct {
Upload types.Dump
TargetPath string
TargetPosition types.Position
TargetPathWithoutRoot string
}
type qualifiedMonikerSet struct {
monikers []precise.QualifiedMonikerData
monikerHashMap map[string]struct{}
}
func newQualifiedMonikerSet() *qualifiedMonikerSet {
return &qualifiedMonikerSet{
monikerHashMap: map[string]struct{}{},
}
}
// add the given qualified moniker to the set if it is distinct from all elements
// currently in the set.
func (s *qualifiedMonikerSet) add(qualifiedMoniker precise.QualifiedMonikerData) {
monikerHash := strings.Join([]string{
qualifiedMoniker.PackageInformationData.Name,
qualifiedMoniker.PackageInformationData.Version,
qualifiedMoniker.MonikerData.Scheme,
qualifiedMoniker.MonikerData.Identifier,
}, ":")
if _, ok := s.monikerHashMap[monikerHash]; ok {
return
}
s.monikerHashMap[monikerHash] = struct{}{}
s.monikers = append(s.monikers, qualifiedMoniker)
}