File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ type F func () (int , error )
4
+
5
+ func f1 () (int , error ) { return 3 , nil }
6
+
7
+ func f2 (a string , f F ) {
8
+ c , _ := f ()
9
+ println (a , c )
10
+ }
11
+
12
+ func main () {
13
+ f2 ("hello" , F (f1 ))
14
+ }
15
+
16
+ // Output:
17
+ // hello 3
Original file line number Diff line number Diff line change @@ -2333,7 +2333,7 @@ func isCall(n *node) bool {
2333
2333
}
2334
2334
2335
2335
func isBinCall (n * node ) bool {
2336
- return n . kind == callExpr && n .child [0 ].typ .cat == valueT && n .child [0 ].typ .rtype .Kind () == reflect .Func
2336
+ return isCall ( n ) && n .child [0 ].typ .cat == valueT && n .child [0 ].typ .rtype .Kind () == reflect .Func
2337
2337
}
2338
2338
2339
2339
func mustReturnValue (n * node ) bool {
@@ -2349,7 +2349,7 @@ func mustReturnValue(n *node) bool {
2349
2349
}
2350
2350
2351
2351
func isRegularCall (n * node ) bool {
2352
- return n . kind == callExpr && n .child [0 ].typ .cat == funcT
2352
+ return isCall ( n ) && n .child [0 ].typ .cat == funcT
2353
2353
}
2354
2354
2355
2355
func variadicPos (n * node ) int {
You can’t perform that action at this time.
0 commit comments