github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/go/callgraph/vta/testdata/src/callgraph_static.go (about)

     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 A struct{}
    10  
    11  func (a A) foo() {}
    12  
    13  func Bar() {}
    14  
    15  func Baz(a A) {
    16  	a.foo()
    17  	Bar()
    18  	Baz(A{})
    19  }
    20  
    21  // Relevant SSA:
    22  // func Baz(a A):
    23  //   ...
    24  //   t2 = (A).foo(t1)
    25  //   t3 = Bar()
    26  //   ...
    27  //   t6 = Baz(t5)
    28  
    29  // WANT:
    30  // Baz: (A).foo(t1) -> A.foo; Bar() -> Bar; Baz(t5) -> Baz