MCPcopy Index your code
hub / github.com/dispatchrun/coroutine / SquareGeneratorTwiceLoop

Function SquareGeneratorTwiceLoop

compiler/testdata/coroutine_durable.go:91–124  ·  view source on GitHub ↗

go:noinline

(_fn0 int)

Source from the content-addressed store, hash-verified

89
90//go:noinline
91func SquareGeneratorTwiceLoop(_fn0 int) {
92 _c := coroutine.LoadContext[int, any]()
93 var _f0 *struct {
94 IP int
95 X0 int
96 X1 int
97 } = coroutine.Push[struct {
98 IP int
99 X0 int
100 X1 int
101 }](&_c.Stack)
102 if _f0.IP == 0 {
103 *_f0 = struct {
104 IP int
105 X0 int
106 X1 int
107 }{X0: _fn0}
108 }
109 defer func() {
110 if !_c.Unwinding() {
111 coroutine.Pop(&_c.Stack)
112 }
113 }()
114 switch {
115 case _f0.IP < 2:
116 _f0.X1 = 0
117 _f0.IP = 2
118 fallthrough
119 case _f0.IP < 3:
120 for ; _f0.X1 < 2; _f0.X1, _f0.IP = _f0.X1+1, 2 {
121 SquareGenerator(_f0.X0)
122 }
123 }
124}
125
126//go:noinline
127func EvenSquareGenerator(_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