| 19 | * Executing this operation returns the identifier which can be used to refer to the variable. |
| 20 | */ |
| 21 | export class TcbBlockImplicitVariableOp extends TcbOp { |
| 22 | constructor( |
| 23 | private tcb: Context, |
| 24 | private scope: Scope, |
| 25 | private type: TcbExpr, |
| 26 | private variable: Variable, |
| 27 | ) { |
| 28 | super(); |
| 29 | } |
| 30 | |
| 31 | override readonly optional = true; |
| 32 | |
| 33 | override execute(): TcbExpr { |
| 34 | const id = new TcbExpr(this.tcb.allocateId()); |
| 35 | id.addParseSpanInfo(this.variable.keySpan); |
| 36 | const variable = declareVariable(id, this.type); |
| 37 | variable.addParseSpanInfo(this.variable.sourceSpan); |
| 38 | this.scope.addStatement(variable); |
| 39 | return id; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * A `TcbOp` which creates an expression for particular let- `Variable` on a |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…