Appearance
| 1 | namespace IR.Values.Load is | |
| 2 | use TypeTyped = Semantic.Types.Typed | |
| 3 | use Semantic.Types.Type | |
| 4 | use SymbolBase = Semantic.Symbols.Symbol | |
| 5 | ||
| 6 | // The cast to the symbol's expected kind is a checked construction | |
| 7 | // invariant: the caller only ever builds this value with a symbol of | |
| 8 | // that kind, so a throw here means the invariant broke elsewhere. | |
| 9 | @suppress("cast-may-throw") | |
| 10 | class INSTANCE_ANONYMOUS_FUNCTION: SYMBOL, TypeTyped is | |
| 11 | is_consumable: bool => true | |
| 12 | ||
| 13 | func_type: Type | |
| 14 | ||
| 15 | // The constructed delegate is what this load yields, which is | |
| 16 | // the target delegate type when the literal was compiled for | |
| 17 | // one rather than the closure's own function type. | |
| 18 | type: Type => func_type | |
| 19 | ||
| 20 | has_address: bool => false | |
| 21 | ||
| 22 | init(symbol: SymbolBase, func_type: Type) is | |
| 23 | super.init(null, symbol) | |
| 24 | ||
| 25 | ||
| 26 | self.func_type = func_type | |
| 27 | si | |
| 28 | ||
| 29 | accept(visitor: Visitor) is | |
| 30 | visitor.visit(self) | |
| 31 | si | |
| 32 | ||
| 33 | to_string() -> string => | |
| 34 | "load:[{type}]({from},\"{symbol.name}\")" | |
| 35 | si | |
| 36 | ||
| 37 | si |