1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:44:44 -07:00
go/pointer/testdata/funcreflect.go
Alan Donovan 6643abb26c go.tools/pointer: inclusion-based pointer analysis for Go.
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
2013-08-22 12:27:55 -04:00

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()
}