mirror of
https://github.com/golang/go
synced 2024-11-19 02:44:44 -07:00
6643abb26c
Suggested reading order: - doc.go - api.go, analysis.go, callgraph.go, labels.go - print.go, util.go - gen.go - solve.go - pointer_test.go, testdata/* - intrinsics.go (none are implemented yet) R=dannyb, gri, crawshaw, 0xjnml CC=golang-dev https://golang.org/cl/10618043
31 lines
420 B
Go
31 lines
420 B
Go
// +build ignore
|
|
|
|
package main
|
|
|
|
//
|
|
|
|
import "reflect"
|
|
|
|
var a, b int
|
|
|
|
func f(p *int) *int {
|
|
print(p) // @pointsto
|
|
return &b
|
|
}
|
|
|
|
func g(p *bool) {
|
|
}
|
|
|
|
func funcreflect1() {
|
|
rvf := reflect.ValueOf(f)
|
|
res := rvf.Call([]reflect.Value{reflect.ValueOf(&a)})
|
|
print(res[0].Interface()) // @concrete
|
|
print(res[0].Interface().(*int)) // @pointsto
|
|
}
|
|
|
|
// @calls main.funcreflect1 -> main.f
|
|
|
|
func main() {
|
|
funcreflect1()
|
|
}
|