2013-07-31 11:13:05 -06:00
|
|
|
//+build ignore
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2013-09-18 12:39:55 -06:00
|
|
|
// This file is the input to TestValueForExpr in source_test.go, which
|
2013-07-31 11:13:05 -06:00
|
|
|
// ensures that each expression e immediately following a /*@kind*/(x)
|
|
|
|
// annotation, when passed to Function.ValueForExpr(e), returns a
|
|
|
|
// non-nil Value of the same type as e and of kind 'kind'.
|
|
|
|
|
|
|
|
func f(param int) {
|
|
|
|
_ = /*@<nil>*/ (1 + 2) // (constant)
|
|
|
|
i := 0
|
|
|
|
/*@Call*/ (print( /*@BinOp*/ (i + 1)))
|
|
|
|
ch := /*@MakeChan*/ (make(chan int))
|
|
|
|
/*@UnOp*/ (<-ch)
|
|
|
|
x := /*@UnOp*/ (<-ch)
|
2013-09-18 12:39:55 -06:00
|
|
|
_ = x
|
2013-07-31 11:13:05 -06:00
|
|
|
select {
|
|
|
|
case /*@Extract*/ (<-ch):
|
|
|
|
case x := /*@Extract*/ (<-ch):
|
2013-09-18 12:39:55 -06:00
|
|
|
_ = x
|
2013-07-31 11:13:05 -06:00
|
|
|
}
|
|
|
|
defer /*@Function*/ (func() {
|
|
|
|
})()
|
|
|
|
go /*@Function*/ (func() {
|
|
|
|
})()
|
|
|
|
y := 0
|
|
|
|
if true && /*@BinOp*/ (bool(y > 0)) {
|
|
|
|
y = 1
|
|
|
|
}
|
|
|
|
_ = /*@Phi*/ (y)
|
|
|
|
map1 := /*@MakeMap*/ (make(map[string]string))
|
2013-09-18 12:39:55 -06:00
|
|
|
_ = map1
|
2013-07-31 11:13:05 -06:00
|
|
|
_ = /*@MakeMap*/ (map[string]string{"": ""})
|
|
|
|
_ = /*@MakeSlice*/ (make([]int, 0))
|
|
|
|
_ = /*@MakeClosure*/ (func() { print(param) })
|
|
|
|
sl := /*@Slice*/ ([]int{})
|
|
|
|
_ = /*@Alloc*/ (&struct{}{})
|
|
|
|
_ = /*@Slice*/ (sl[:0])
|
|
|
|
_ = /*@Alloc*/ (new(int))
|
|
|
|
var iface interface{}
|
|
|
|
_ = /*@TypeAssert*/ (iface.(int))
|
|
|
|
_ = /*@UnOp*/ (sl[0])
|
|
|
|
_ = /*@IndexAddr*/ (&sl[0])
|
|
|
|
_ = /*@Index*/ ([2]int{}[0])
|
|
|
|
var p *int
|
|
|
|
_ = /*@UnOp*/ (*p)
|
|
|
|
}
|