| 1 | // Copyright 2021 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // trie implements persistent Patricia trie maps. |
| 6 | // |
| 7 | // Each Map is effectively a map from uint64 to interface{}. Patricia tries are |
| 8 | // a form of radix tree that are particularly appropriate when many maps will be |
| 9 | // created, merged together and large amounts of sharing are expected (e.g. |
| 10 | // environment abstract domains in program analysis). |
| 11 | // |
| 12 | // This implementation closely follows the paper: |
| 13 | // |
| 14 | // C. Okasaki and A. Gill, “Fast mergeable integer maps,” in ACM SIGPLAN |
| 15 | // Workshop on ML, September 1998, pp. 77–86. |
| 16 | // |
| 17 | // Each Map is immutable and can be read from concurrently. The map does not |
| 18 | // guarantee that the value pointed to by the interface{} value is not updated |
| 19 | // concurrently. |
| 20 | // |
| 21 | // These Maps are optimized for situations where there will be many maps created at |
| 22 | // with a high degree of sharing and combining of maps together. If you do not expect, |
| 23 | // significant amount of sharing, the builtin map[T]U is much better choice! |
| 24 | // |
| 25 | // Each Map is created by a Builder. Each Builder has a unique Scope and each node is |
| 26 | // created within this scope. Maps x and y are == if they contains the same |
| 27 | // (key,value) mappings and have equal scopes. |
| 28 | // |
| 29 | // Internally these are big endian Patricia trie nodes, and the keys are sorted. |
| 30 | package triescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/ |
| 31 | |
| 32 | import ( |
| 33 | "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/" |
| 34 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 35 | ) |
| 36 | |
| 37 | // Map is effectively a finite mapping from uint64 keys to interface{} values. |
| 38 | // Maps are immutable and can be read from concurrently. |
| 39 | // |
| 40 | // Notes on concurrency: |
| 41 | // - A Map value itself is an interface and assignments to a Map value can race. |
| 42 | // - Map does not guarantee that the value pointed to by the interface{} value |
| 43 | // is not updated concurrently. |
| 44 | type Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map# struct { |
| 45 | sscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#s. Scopescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Scope# |
| 46 | nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node# |
| 47 | } |
| 48 | |
| 49 | func (m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) Scopescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Scope().() Scopescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Scope# { |
| 50 | return m.sscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#s. |
| 51 | } |
| 52 | func (m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) Sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Size().() int { |
| 53 | if m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. == nil { |
| 54 | return 0 |
| 55 | } |
| 56 | return m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n..sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#size.() |
| 57 | } |
| 58 | func (m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) Lookupscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Lookup().(k uint64) (any, bool) { |
| 59 | if m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. != nil { |
| 60 | if leaf := m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n..findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#find.(keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/key#(k)); leaf != nil { |
| 61 | return leaf.vscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#v., true |
| 62 | } |
| 63 | } |
| 64 | return nil, false |
| 65 | } |
| 66 | |
| 67 | // Converts the map into a {<key>: <value>[, ...]} string. This uses the default |
| 68 | // %s string conversion for <value>. |
| 69 | func (m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) Stringscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#String().() string { |
| 70 | var kvs []string |
| 71 | m.Rangescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Range().(func(u uint64, i any) bool { |
| 72 | kvs = append(kvs, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("%d: %s", u, i)) |
| 73 | return true |
| 74 | }) |
| 75 | return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Sprintf().("{%s}", stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Joinscip-go gomod github.com/golang/go/src go1.25.0 strings/Join().(kvs, ", ")) |
| 76 | } |
| 77 | |
| 78 | // Range over the leaf (key, value) pairs in the map in order and |
| 79 | // applies cb(key, value) to each. Stops early if cb returns false. |
| 80 | // Returns true if all elements were visited without stopping early. |
| 81 | func (m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) Rangescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Range().(cb func(uint64, any) bool) bool { |
| 82 | if m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. != nil { |
| 83 | return m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n..visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#visit.(cb) |
| 84 | } |
| 85 | return true |
| 86 | } |
| 87 | |
| 88 | // DeepEqual returns true if m and other contain the same (k, v) mappings |
| 89 | // [regardless of Scope]. |
| 90 | // |
| 91 | // Equivalently m.DeepEqual(other) <=> reflect.DeepEqual(Elems(m), Elems(other)) |
| 92 | func (m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) DeepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#DeepEqual().(other Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) bool { |
| 93 | if m.Scopescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Scope().() == other.Scopescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Scope().() { |
| 94 | return m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. == other.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. |
| 95 | } |
| 96 | if (m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. == nil) || (other.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n. == nil) { |
| 97 | return m.Sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Size().() == 0 && other.Sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Size().() == 0 |
| 98 | } |
| 99 | return m.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n..deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#deepEqual.(other.nscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#n.) |
| 100 | } |
| 101 | |
| 102 | // Elems are the (k,v) elements in the Map as a map[uint64]interface{} |
| 103 | func Elemsscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Elems().(m Mapscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#) map[uint64]any { |
| 104 | dest := make(map[uint64]any, m.Sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Size().()) |
| 105 | m.Rangescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Map#Range().(func(k uint64, v any) bool { |
| 106 | dest[k] = v |
| 107 | return true |
| 108 | }) |
| 109 | return dest |
| 110 | } |
| 111 | |
| 112 | // node is an internal node within a trie map. |
| 113 | // A node is either empty, a leaf or a branch. |
| 114 | type nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node# interface { |
| 115 | sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#size.() int |
| 116 | |
| 117 | // visit the leaves (key, value) pairs in the map in order and |
| 118 | // applies cb(key, value) to each. Stops early if cb returns false. |
| 119 | // Returns true if all elements were visited without stopping early. |
| 120 | visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#visit.(cb func(uint64, any) bool) bool |
| 121 | |
| 122 | // Two nodes contain the same elements regardless of scope. |
| 123 | deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#deepEqual.(nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#) bool |
| 124 | |
| 125 | // find the leaf for the given key value or nil if it is not present. |
| 126 | findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#find.(k keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/key#) *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf# |
| 127 | |
| 128 | // implementations must implement this. |
| 129 | nodeImplscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#nodeImpl.() |
| 130 | } |
| 131 | |
| 132 | // empty represents the empty map within a scope. |
| 133 | // |
| 134 | // The current builder ensure |
| 135 | type emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty# struct { |
| 136 | sscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#s. Scopescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/Scope# |
| 137 | } |
| 138 | |
| 139 | // leaf represents a single <key, value> pair. |
| 140 | type leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf# struct { |
| 141 | kscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#k. keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/key# |
| 142 | vscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#v. any |
| 143 | } |
| 144 | |
| 145 | // branch represents a tree node within the Patricia trie. |
| 146 | // |
| 147 | // All keys within the branch match a `prefix` of the key |
| 148 | // up to a `branching` bit, and the left and right nodes |
| 149 | // contain keys that disagree on the bit at the `branching` bit. |
| 150 | type branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch# struct { |
| 151 | szscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#sz. int // size. cached for O(1) lookup |
| 152 | prefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#prefix. prefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/prefix# // == mask(p0, branching) for some p0 |
| 153 | branchingscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#branching. bitposscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/bitpos# |
| 154 | |
| 155 | // Invariants: |
| 156 | // - neither is nil. |
| 157 | // - neither is *empty. |
| 158 | // - all keys in left are <= p. |
| 159 | // - all keys in right are > p. |
| 160 | leftscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#left., rightscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#right. nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node# |
| 161 | } |
| 162 | |
| 163 | // all of these types are Maps. |
| 164 | var _ nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node# = &emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#{} |
| 165 | var _ nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node# = &leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#{} |
| 166 | var _ nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node# = &branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#{} |
| 167 | |
| 168 | func (*emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#) nodeImplscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#nodeImpl().() {} |
| 169 | func (*leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#) nodeImplscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#nodeImpl().() {} |
| 170 | func (*branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#) nodeImplscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#nodeImpl().() {} |
| 171 | |
| 172 | func (*emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#) findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#find().(k keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/key#) *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf# { return nil } |
| 173 | func (l *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#) findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#find().(k keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/key#) *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf# { |
| 174 | if k == l.kscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#k. { |
| 175 | return l |
| 176 | } |
| 177 | return nil |
| 178 | } |
| 179 | func (br *branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#) findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#find().(k keyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/key#) *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf# { |
| 180 | kp := prefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/prefix#(k) |
| 181 | if !matchPrefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/matchPrefix().(kp, br.prefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#prefix., br.branchingscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#branching.) { |
| 182 | return nil |
| 183 | } |
| 184 | if zeroBitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/zeroBit().(kp, br.branchingscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#branching.) { |
| 185 | return br.leftscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#left..findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#find.(k) |
| 186 | } |
| 187 | return br.rightscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#right..findscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#find.(k) |
| 188 | } |
| 189 | |
| 190 | func (*emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#) sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#size().() int { return 0 } |
| 191 | func (*leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#) sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#size().() int { return 1 } |
| 192 | func (br *branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#) sizescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#size().() int { return br.szscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#sz. } |
| 193 | |
| 194 | func (*emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#) deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#deepEqual().(m nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#) bool { |
| 195 | _, ok := m.(*emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#) |
| 196 | return ok |
| 197 | } |
| 198 | func (l *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#) deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#deepEqual().(m nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#) bool { |
| 199 | if m, ok := m.(*leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#); ok { |
| 200 | return m == l || (l.kscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#k. == m.kscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#k. && l.vscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#v. == m.vscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#v.) |
| 201 | } |
| 202 | return false |
| 203 | } |
| 204 | |
| 205 | func (br *branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#) deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#deepEqual().(m nodescip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#) bool { |
| 206 | if m, ok := m.(*branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#); ok { |
| 207 | if br == m { |
| 208 | return true |
| 209 | } |
| 210 | return br.szscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#sz. == m.szscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#sz. && br.branchingscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#branching. == m.branchingscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#branching. && br.prefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#prefix. == m.prefixscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#prefix. && |
| 211 | br.leftscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#left..deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#deepEqual.(m.leftscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#left.) && br.rightscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#right..deepEqualscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#deepEqual.(m.rightscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#right.) |
| 212 | } |
| 213 | // if m is not a branch, m contains 0 or 1 elem. |
| 214 | // br contains at least 2 keys that disagree on a prefix. |
| 215 | return false |
| 216 | } |
| 217 | |
| 218 | func (*emptyscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#) visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/empty#visit().(cb func(uint64, any) bool) bool { |
| 219 | return true |
| 220 | } |
| 221 | func (l *leafscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#) visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#visit().(cb func(uint64, any) bool) bool { |
| 222 | return cb(uint64(l.kscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#k.), l.vscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/leaf#v.) |
| 223 | } |
| 224 | func (br *branchscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#) visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#visit().(cb func(uint64, any) bool) bool { |
| 225 | if !br.leftscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#left..visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#visit.(cb) { |
| 226 | return false |
| 227 | } |
| 228 | return br.rightscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/branch#right..visitscip-go gomod golang.org/x/tools . `golang.org/x/tools/go/callgraph/vta/internal/trie`/node#visit.(cb) |
| 229 | } |