| 1 |
// build |
| 2 |
|
| 3 |
// Copyright 2025 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Issue 73716: cmd/compile: unnamed functions missing FuncInfo |
| 8 |
|
| 9 |
package main |
| 10 |
|
| 11 |
import "fmt" |
| 12 |
|
| 13 |
type EP func() |
| 14 |
type F func(EP) EP |
| 15 |
|
| 16 |
func main() { |
| 17 |
eps := []EP{ep1, ep2} |
| 18 |
var h EP |
| 19 |
|
| 20 |
for _, ep := range eps { |
| 21 |
h = F(func(e EP) EP { |
| 22 |
return func() { |
| 23 |
ep() |
| 24 |
e() |
| 25 |
} |
| 26 |
})(h) |
| 27 |
} |
| 28 |
h() |
| 29 |
} |
| 30 |
|
| 31 |
func ep1() { |
| 32 |
fmt.Printf("ep1\n") |
| 33 |
} |
| 34 |
|
| 35 |
func ep2() { |
| 36 |
fmt.Printf("ep2\n") |
| 37 |
} |