ssa: closure use specific struct field name { $f ftype, $data unsafe.pointer }
This commit is contained in:
@@ -93,12 +93,11 @@ func callMethod() {
|
||||
println("method", fn.Kind(), fn.Type().String())
|
||||
r := fn.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r[0].Int())
|
||||
//TODO type assert
|
||||
// ifn, ok := fn.Interface().(func(int) int)
|
||||
// if !ok {
|
||||
// panic("error")
|
||||
// }
|
||||
// ifn(1)
|
||||
ifn, ok := fn.Interface().(func(int) int)
|
||||
if !ok {
|
||||
panic("error")
|
||||
}
|
||||
ifn(1)
|
||||
v2 := reflect.ValueOf(fn.Interface())
|
||||
r2 := v2.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r2[0].Int())
|
||||
@@ -111,12 +110,11 @@ func callIMethod() {
|
||||
println("imethod", fn.Kind(), fn.Type().String())
|
||||
r := fn.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r[0].Int())
|
||||
//TODO type assert
|
||||
// ifn, ok := fn.Interface().(func(int) int)
|
||||
// if !ok {
|
||||
// panic("error")
|
||||
// }
|
||||
// ifn(1)
|
||||
ifn, ok := fn.Interface().(func(int) int)
|
||||
if !ok {
|
||||
panic("error")
|
||||
}
|
||||
ifn(1)
|
||||
v2 := reflect.ValueOf(fn.Interface())
|
||||
r2 := v2.Call([]reflect.Value{reflect.ValueOf(100)})
|
||||
println(r2[0].Int())
|
||||
|
||||
Reference in New Issue
Block a user