golang.org/x/tools@v0.21.1-0.20240520172518-788d39e776b1/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  //   t0 = (A).foo(a)
    24  //   t1 = Bar()
    25  //   t2 = Baz(struct{}{}:A)
    26  
    27  // WANT:
    28  // Baz: (A).foo(a) -> A.foo; Bar() -> Bar; Baz(struct{}{}:A) -> Baz