Debian Codegraph @

go/callgraph/vta/testdata/src/static_calls.go

raw symbols SCIP
1 // Copyright 2021 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // go:build ignore
6
7 package testdata
8
9 type I interface{}
10
11 func foo(i I) (I, I) {
12 return i, i
13 }
14
15 func doWork(ii I) {}
16
17 func close(iii I) {}
18
19 func Baz(inp I) {
20 a, b := foo(inp)
21 defer close(a)
22 go doWork(b)
23 }
24
25 // Relevant SSA:
26 // func Baz(inp I):
27 // t0 = foo(inp)
28 // t1 = extract t0 #0
29 // t2 = extract t0 #1
30 // defer close(t1)
31 // go doWork(t2)
32 // rundefers
33 // ...
34 // func foo(i I) (I, I):
35 // return i, i
36
37 // WANT:
38 // Local(inp) -> Local(i)
39 // Local(t1) -> Local(iii)
40 // Local(t2) -> Local(ii)
41 // Local(i) -> Return(foo[0]), Return(foo[1])
42 // Return(foo[0]) -> Local(t0[0])
43 // Return(foo[1]) -> Local(t0[1])