Skip to content

Commit

Permalink
Making vcKeyScope.Hash() consider var indices
Browse files Browse the repository at this point in the history
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
  • Loading branch information
johanfylling committed Aug 26, 2024
1 parent 33f6d95 commit bb071c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions topdown/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2924,16 +2924,16 @@ func (q vcKeyScope) Compare(other ast.Value) int {
return 1
}

func (q vcKeyScope) Find(_ ast.Ref) (ast.Value, error) {
func (vcKeyScope) Find(ast.Ref) (ast.Value, error) {
return nil, nil
}

func (q vcKeyScope) Hash() int {
var hash int
for _, v := range q.Ref {
for i, v := range q.Ref {
if _, ok := v.Value.(ast.Var); ok {
// all vars are equal
hash++
hash += i + 1
} else {
hash += v.Value.Hash()
}
Expand Down

0 comments on commit bb071c5

Please sign in to comment.