use GetTagId

This commit is contained in:
Folkert 2021-06-20 17:02:32 +02:00
parent db05e55752
commit 1e7cb5da00
2 changed files with 5 additions and 7 deletions

View file

@ -1351,7 +1351,7 @@ impl<'a> Expr<'a> {
RuntimeErrorFunction(s) => alloc.text(format!("ErrorFunction {}", s)), RuntimeErrorFunction(s) => alloc.text(format!("ErrorFunction {}", s)),
GetTagId { structure, .. } => alloc GetTagId { structure, .. } => alloc
.text("GetTagId") .text("GetTagId ")
.append(symbol_to_doc(alloc, *structure)), .append(symbol_to_doc(alloc, *structure)),
} }
} }
@ -7755,7 +7755,7 @@ fn match_on_lambda_set<'a>(
hole: &'a Stmt<'a>, hole: &'a Stmt<'a>,
) -> Stmt<'a> { ) -> Stmt<'a> {
match lambda_set.runtime_representation() { match lambda_set.runtime_representation() {
Layout::Union(_) => { Layout::Union(union_layout) => {
let closure_tag_id_symbol = env.unique_symbol(); let closure_tag_id_symbol = env.unique_symbol();
let result = union_lambda_set_to_switch( let result = union_lambda_set_to_switch(
@ -7773,11 +7773,9 @@ fn match_on_lambda_set<'a>(
); );
// extract & assign the closure_tag_id_symbol // extract & assign the closure_tag_id_symbol
let expr = Expr::AccessAtIndex { let expr = Expr::GetTagId {
index: 0,
field_layouts: env.arena.alloc([Layout::Builtin(Builtin::Int64)]),
structure: closure_data_symbol, structure: closure_data_symbol,
wrapped: Wrapped::MultiTagUnion, union_layout,
}; };
Stmt::Let( Stmt::Let(

View file

@ -21,7 +21,7 @@ procedure Test.0 ():
let Test.5 = 2i64; let Test.5 = 2i64;
let Test.12 = 42i64; let Test.12 = 42i64;
joinpoint Test.19 Test.13: joinpoint Test.19 Test.13:
let Test.14 = Index 0 Test.13; let Test.14 = GetTagId Test.13;
joinpoint Test.15 Test.11: joinpoint Test.15 Test.11:
ret Test.11; ret Test.11;
in in