Skip to content

Commit 2f839a0

Browse files
authored
Merge pull request #37 from gostaticanalysis/fix-Used-UnOp
Fix UnOp
2 parents 83d857c + d2aabab commit 2f839a0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

ssa.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ func usedInInstr(v ssa.Value, instr ssa.Instruction) ssa.Instruction {
109109
}
110110
}
111111
}
112+
113+
switch v := v.(type) {
114+
case *ssa.UnOp:
115+
return usedInInstr(v.X, instr)
116+
}
117+
112118
return nil
113119
}
114120

testdata/src/used/used.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@ func f8(v interface{}) { // want "used"
4646
println(v)
4747
}()
4848
}
49+
50+
func f9(v interface{}) { // want "used"
51+
func(v interface{}) { // want "used"
52+
println(v)
53+
}(v)
54+
}

0 commit comments

Comments
 (0)