Skip to content
← Back

src/ir/values/tuple_repack.ghul

1
namespace IR.Values is
2
use Semantic.Types.Type
3
4
// Converts a tuple to a tuple type whose elements each accept the
5
// source's. A value tuple is invariant in the CLR, so the source is
6
// spilled to a local and `built`, which constructs the target tuple
7
// from loads of that local's elements, is generated in its place.
8
class TUPLE_REPACK(source: Value, temp: IR.LOCAL, built: Value): Value is
9
type: Type? pure => built.type
10
is_lightweight_pure: bool => false
11
12
accept(visitor: Visitor) is
13
visitor.visit(self)
14
si
15
16
to_string() -> string =>
17
"tuple-repack:[{type}]({source})"
18
si
19
si