Appearance
| 1 | namespace Syntax.Trees.Expressions is | |
| 2 | ||
| 3 | use Source | |
| 4 | ||
| 5 | // `use E` expression. Evaluates to the operand's value, and disposes | |
| 6 | // that value when the enclosing statement list ends. | |
| 7 | class USE: Expression is | |
| 8 | operand: Expression | |
| 9 | ||
| 10 | use_state: Syntax.Process.USE_STATE field | |
| 11 | ||
| 12 | // The local the value is held in until it is disposed. Declared | |
| 13 | // once and retyped by later walks, so a capture or a registration | |
| 14 | // made on one walk still names it on the next. | |
| 15 | target: Semantic.Symbols.Variable? public => use_state.target, = value is use_state.target = value si | |
| 16 | ||
| 17 | init(location: LOCATION, operand: Expression) is | |
| 18 | super.init(location) | |
| 19 | ||
| 20 | self.operand = operand | |
| 21 | si | |
| 22 | ||
| 23 | clear() is | |
| 24 | super.clear() | |
| 25 | use_state.clear() | |
| 26 | si | |
| 27 | ||
| 28 | accept(visitor: Visitor) is | |
| 29 | visitor.visit(self) | |
| 30 | si | |
| 31 | ||
| 32 | walk(visitor: Visitor) is | |
| 33 | if !visitor.pre(self) then | |
| 34 | operand.walk(visitor) | |
| 35 | fi | |
| 36 | accept(visitor) | |
| 37 | si | |
| 38 | si | |
| 39 | si |