From d2aabab95c40d90d656ecd7c8d78876597191873 Mon Sep 17 00:00:00 2001 From: tenntenn Date: Thu, 1 Oct 2020 20:40:41 +0900 Subject: [PATCH] Fix UnOp --- ssa.go | 6 ++++++ testdata/src/used/used.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ssa.go b/ssa.go index 79cec17..517f6b9 100644 --- a/ssa.go +++ b/ssa.go @@ -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 } diff --git a/testdata/src/used/used.go b/testdata/src/used/used.go index 90e60e8..0fa5317 100644 --- a/testdata/src/used/used.go +++ b/testdata/src/used/used.go @@ -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) +}