Skip to content
← Back

src/syntax/trees/statements/for.ghul

1
namespace Syntax.Trees.Statements is
2
use Source;
3
4
class FOR(
5
location: LOCATION,
6
variable: Variables.VARIABLE?,
7
expression: Expressions.Expression?,
8
body: Statements.LIST?
9
): Statement, ScopeCarrier is
10
scope: Semantic.Scope? public;
11
12
read_iterator: Semantic.Symbols.Function? public;
13
read_current: Semantic.Symbols.Function? public;
14
move_next: Semantic.Symbols.Function? public;
15
16
// Set by compile-expressions when the loop expression is a
17
// fusible Pipe[T] chain: the IL pass then lowers the whole
18
// chain to one inline loop instead of iterating the built pipe
19
// objects. Null means iterate normally. See
20
// Syntax.Process.PIPE_FUSION_RECOGNIZER.
21
fusion: Syntax.Process.PIPE_FUSION? public;
22
23
super(location);
24
25
accept(visitor: Visitor) is
26
visitor.visit(self);
27
si
28
29
walk(visitor: Visitor) is
30
if !visitor.pre(self) then
31
if variable? then
32
variable.walk(visitor);
33
fi
34
35
if expression? then
36
expression.walk(visitor);
37
fi
38
39
if body? then
40
body.walk(visitor);
41
fi
42
fi
43
44
accept(visitor);
45
si
46
si
47
si