MCPcopy Create free account
hub / github.com/dispatchrun/coroutine / SquareGeneratorTwice

Function SquareGeneratorTwice

compiler/testdata/coroutine_durable.go:60–88  ·  view source on GitHub ↗

go:noinline

(_fn0 int)

Source from the content-addressed store, hash-verified

58
59//go:noinline
60func SquareGeneratorTwice(_fn0 int) {
61 _c := coroutine.LoadContext[int, any]()
62 var _f0 *struct {
63 IP int
64 X0 int
65 } = coroutine.Push[struct {
66 IP int
67 X0 int
68 }](&_c.Stack)
69 if _f0.IP == 0 {
70 *_f0 = struct {
71 IP int
72 X0 int
73 }{X0: _fn0}
74 }
75 defer func() {
76 if !_c.Unwinding() {
77 coroutine.Pop(&_c.Stack)
78 }
79 }()
80 switch {
81 case _f0.IP < 2:
82 SquareGenerator(_f0.X0)
83 _f0.IP = 2
84 fallthrough
85 case _f0.IP < 3:
86 SquareGenerator(_f0.X0)
87 }
88}
89
90//go:noinline
91func SquareGeneratorTwiceLoop(_fn0 int) {

Callers

nothing calls this directly

Calls 4

LoadContextFunction · 0.92
PopFunction · 0.92
UnwindingMethod · 0.80
SquareGeneratorFunction · 0.70

Tested by

no test coverage detected