Skip to content
← Back

src/ir/values/state_machine_field.ghul

1
namespace IR.Values is
2
use Semantic.Symbols.Symbol
3
use Semantic.Symbols.Variable
4
5
// A generator or async local/argument has no CLR slot inside the
6
// MoveNext method — access routes through a field on the
7
// state-machine frame (`ldarg.0; ldfld/stfld <field>`). Returns
8
// that field's IL reference, or null for an ordinary local that
9
// keeps its CLR slot.
10
// The same field as a symbol, so a metadata token is built from the
11
// field rather than from its spelling.
12
state_machine_field_for(symbol: Symbol?) -> Semantic.Symbols.Field? is
13
if let variable: Variable = symbol then
14
return variable.state_machine_field
15
fi
16
17
return null
18
si
19
si