Skip to content
← Back

src/ir/local.ghul

1
namespace IR is
2
use Semantic.Types.Type
3
4
// A local of the function being generated. Locals are told apart by
5
// identity: the name is only for reading the IR, and two locals may
6
// share one.
7
//
8
// The type is settled by the time the local is declared, which can
9
// be after values that read it were built.
10
class LOCAL is
11
name: string
12
type: Type public
13
14
/// Where the local holds a `for` loop's iterator, what the loop
15
/// iterates and the calls it makes on it.
16
iteration: FOR_ITERATION? public
17
18
init(name: string, type: Type) is
19
self.name = name
20
self.type = type
21
si
22
23
load() -> Values.Value => Values.Load.TEMP(self)
24
25
to_string() -> string => name
26
si
27
si