loopNext starts the next iteration of the loop.
(loop *Loop)
| 7 | |
| 8 | // loopNext starts the next iteration of the loop. |
| 9 | func (f *Function) loopNext(loop *Loop) { |
| 10 | if loop.IteratorName != "" { |
| 11 | endOfLoopValue, _, _ := f.findIdentifier(loop.IteratorName) |
| 12 | one := f.Append(&ssa.Int{Int: 1}) |
| 13 | |
| 14 | nextIteration := &ssa.BinaryOp{ |
| 15 | Op: token.Add, |
| 16 | Left: endOfLoopValue, |
| 17 | Right: one, |
| 18 | } |
| 19 | |
| 20 | f.Block().Append(nextIteration) |
| 21 | f.Block().Identify(loop.IteratorName, nextIteration) |
| 22 | } |
| 23 | |
| 24 | f.jump(loop.Head) |
| 25 | } |
no test coverage detected