fix: generate closures for literal functions in CFG
This commit is contained in:
committed by
Traefiker Bot
parent
7d19108f01
commit
4f95c27634
10
_test/closure8.go
Normal file
10
_test/closure8.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package main
|
||||
|
||||
var f = func(a int) int { return 2 + a }
|
||||
|
||||
func main() {
|
||||
println(f(3))
|
||||
}
|
||||
|
||||
// Output:
|
||||
// 5
|
||||
@@ -871,6 +871,7 @@ func (interp *Interpreter) cfg(root *node) ([]*node, error) {
|
||||
case funcLit:
|
||||
n.types = sc.types
|
||||
sc = sc.pop()
|
||||
err = genRun(n)
|
||||
|
||||
case goStmt:
|
||||
wireChild(n)
|
||||
|
||||
Reference in New Issue
Block a user