MCPcopy Index your code
hub / github.com/uber-go/nilaway / getReturnInstrs

Function getReturnInstrs

assertion/function/functioncontracts/infer.go:296–309  ·  view source on GitHub ↗
(fn *ssa.Function)

Source from the content-addressed store, hash-verified

294}
295
296func getReturnInstrs(fn *ssa.Function) []*ssa.Return {
297 returnInstrs := make([]*ssa.Return, 0)
298 for _, b := range fn.Blocks {
299 // len(x) still returns 0 when x is nil
300 if len(b.Succs) != 0 || len(b.Instrs) == 0 {
301 continue
302 }
303 // b is an exit block, either panic or return
304 if instr, ok := b.Instrs[len(b.Instrs)-1].(*ssa.Return); ok {
305 returnInstrs = append(returnInstrs, instr)
306 }
307 }
308 return returnInstrs
309}
310
311// branch reports whether we can make a branch and learn nilness from the true and false successor.
312// The function returns equal, not-equal successor and the binary operation iff

Callers 1

inferContractsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected