Skip to content

Commit

Permalink
Merge pull request #37 from gostaticanalysis/fix-Used-UnOp
Browse files Browse the repository at this point in the history
Fix UnOp
  • Loading branch information
tenntenn authored Oct 1, 2020
2 parents 83d857c + d2aabab commit 2f839a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ func usedInInstr(v ssa.Value, instr ssa.Instruction) ssa.Instruction {
}
}
}

switch v := v.(type) {
case *ssa.UnOp:
return usedInInstr(v.X, instr)
}

return nil
}

Expand Down
6 changes: 6 additions & 0 deletions testdata/src/used/used.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ func f8(v interface{}) { // want "used"
println(v)
}()
}

func f9(v interface{}) { // want "used"
func(v interface{}) { // want "used"
println(v)
}(v)
}

0 comments on commit 2f839a0

Please sign in to comment.