Appearance
| 1 | namespace Syntax.Trees.Statements is | |
| 2 | use Source | |
| 3 | ||
| 4 | // `yield in E` - yield every element of E in turn. The iterator | |
| 5 | // surface is resolved exactly as a `for` loop's is; the difference | |
| 6 | // is the loop body, which suspends the enclosing generator with the | |
| 7 | // element rather than running user statements. | |
| 8 | class YIELD_ALL(location: LOCATION, expression: Expressions.Expression public): Statement, IteratorCarrier is | |
| 9 | expects_semicolon: bool => true | |
| 10 | ||
| 11 | iterated: Expressions.Expression? => expression | |
| 12 | ||
| 13 | read_iterator: Semantic.Symbols.Function? public => iterator_state.read_iterator, = value is iterator_state.read_iterator = value si | |
| 14 | read_current: Semantic.Symbols.Function? public => iterator_state.read_current, = value is iterator_state.read_current = value si | |
| 15 | move_next: Semantic.Symbols.Function? public => iterator_state.move_next, = value is iterator_state.move_next = value si | |
| 16 | ||
| 17 | iterator_field: Semantic.Symbols.Field? public => iterator_state.iterator_field, = value is iterator_state.iterator_field = value si | |
| 18 | ||
| 19 | iterator_state: Syntax.Process.ITERATOR_STATE field | |
| 20 | ||
| 21 | clear() is | |
| 22 | super.clear() | |
| 23 | iterator_state.clear() | |
| 24 | si | |
| 25 | ||
| 26 | clear_outputs() is | |
| 27 | super.clear_outputs() | |
| 28 | iterator_state.clear_outputs() | |
| 29 | si | |
| 30 | ||
| 31 | super(location) | |
| 32 | ||
| 33 | accept(visitor: Visitor) is | |
| 34 | visitor.visit(self) | |
| 35 | si | |
| 36 | ||
| 37 | walk(visitor: Visitor) is | |
| 38 | if !visitor.pre(self) then | |
| 39 | expression.walk(visitor) | |
| 40 | fi | |
| 41 | ||
| 42 | accept(visitor) | |
| 43 | si | |
| 44 | si | |
| 45 | si |