mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Merge remote-tracking branch 'origin/trunk' into add-dec-types
This commit is contained in:
commit
cb42f0c039
16 changed files with 1471 additions and 443 deletions
|
@ -227,6 +227,19 @@ impl<'a> Proc<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn insert_reset_reuse_operations<'i>(
|
||||
arena: &'a Bump,
|
||||
home: ModuleId,
|
||||
ident_ids: &'i mut IdentIds,
|
||||
procs: &mut MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>,
|
||||
) {
|
||||
for (_, proc) in procs.iter_mut() {
|
||||
let new_proc =
|
||||
crate::reset_reuse::insert_reset_reuse(arena, home, ident_ids, proc.clone());
|
||||
*proc = new_proc;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn optimize_refcount_operations<'i, T>(
|
||||
arena: &'a Bump,
|
||||
home: ModuleId,
|
||||
|
@ -1129,7 +1142,6 @@ pub enum Expr<'a> {
|
|||
tag_layout: UnionLayout<'a>,
|
||||
tag_name: TagName,
|
||||
tag_id: u8,
|
||||
union_size: u8,
|
||||
arguments: &'a [Symbol],
|
||||
},
|
||||
Struct(&'a [Symbol]),
|
||||
|
@ -1160,6 +1172,9 @@ pub enum Expr<'a> {
|
|||
|
||||
Reuse {
|
||||
symbol: Symbol,
|
||||
update_tag_id: bool,
|
||||
// normal Tag fields
|
||||
tag_layout: UnionLayout<'a>,
|
||||
tag_name: TagName,
|
||||
tag_id: u8,
|
||||
arguments: &'a [Symbol],
|
||||
|
@ -1273,11 +1288,12 @@ impl<'a> Expr<'a> {
|
|||
alloc
|
||||
.text("Reuse ")
|
||||
.append(symbol_to_doc(alloc, *symbol))
|
||||
.append(alloc.space())
|
||||
.append(doc_tag)
|
||||
.append(alloc.space())
|
||||
.append(alloc.intersperse(it, " "))
|
||||
}
|
||||
Reset(symbol) => alloc.text("Reuse ").append(symbol_to_doc(alloc, *symbol)),
|
||||
Reset(symbol) => alloc.text("Reset ").append(symbol_to_doc(alloc, *symbol)),
|
||||
|
||||
Struct(args) => {
|
||||
let it = args.iter().map(|s| symbol_to_doc(alloc, *s));
|
||||
|
@ -4036,14 +4052,12 @@ fn construct_closure_data<'a>(
|
|||
ClosureRepresentation::Union {
|
||||
tag_id,
|
||||
tag_layout: _,
|
||||
union_size,
|
||||
tag_name,
|
||||
union_layout,
|
||||
} => {
|
||||
let expr = Expr::Tag {
|
||||
tag_id,
|
||||
tag_layout: union_layout,
|
||||
union_size,
|
||||
tag_name,
|
||||
arguments: symbols,
|
||||
};
|
||||
|
@ -4172,7 +4186,6 @@ fn convert_tag_union<'a>(
|
|||
assign_to_symbols(env, procs, layout_cache, iter, stmt)
|
||||
}
|
||||
Wrapped(variant) => {
|
||||
let union_size = variant.number_of_tags() as u8;
|
||||
let (tag_id, _) = variant.tag_name_to_id(&tag_name);
|
||||
|
||||
let field_symbols_temp = sorted_field_symbols(env, procs, layout_cache, args);
|
||||
|
@ -4208,7 +4221,6 @@ fn convert_tag_union<'a>(
|
|||
tag_layout: union_layout,
|
||||
tag_name,
|
||||
tag_id: tag_id as u8,
|
||||
union_size,
|
||||
arguments: field_symbols,
|
||||
};
|
||||
|
||||
|
@ -4236,7 +4248,6 @@ fn convert_tag_union<'a>(
|
|||
tag_layout: union_layout,
|
||||
tag_name,
|
||||
tag_id: tag_id as u8,
|
||||
union_size,
|
||||
arguments: field_symbols,
|
||||
};
|
||||
|
||||
|
@ -4266,7 +4277,6 @@ fn convert_tag_union<'a>(
|
|||
tag_layout: union_layout,
|
||||
tag_name,
|
||||
tag_id: tag_id as u8,
|
||||
union_size,
|
||||
arguments: field_symbols,
|
||||
};
|
||||
|
||||
|
@ -4303,7 +4313,6 @@ fn convert_tag_union<'a>(
|
|||
tag_layout: union_layout,
|
||||
tag_name,
|
||||
tag_id: tag_id as u8,
|
||||
union_size,
|
||||
arguments: field_symbols,
|
||||
};
|
||||
|
||||
|
@ -4336,7 +4345,6 @@ fn convert_tag_union<'a>(
|
|||
tag_layout: union_layout,
|
||||
tag_name,
|
||||
tag_id: tag_id as u8,
|
||||
union_size,
|
||||
arguments: field_symbols,
|
||||
};
|
||||
|
||||
|
@ -5382,7 +5390,6 @@ fn substitute_in_expr<'a>(
|
|||
tag_layout,
|
||||
tag_name,
|
||||
tag_id,
|
||||
union_size,
|
||||
arguments: args,
|
||||
} => {
|
||||
let mut did_change = false;
|
||||
|
@ -5404,7 +5411,6 @@ fn substitute_in_expr<'a>(
|
|||
tag_layout: *tag_layout,
|
||||
tag_name: tag_name.clone(),
|
||||
tag_id: *tag_id,
|
||||
union_size: *union_size,
|
||||
arguments,
|
||||
})
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue