misc cleanup suggestions

This commit is contained in:
Brendan Hansknecht 2023-11-20 21:33:47 -08:00
parent 2ef97fc5a1
commit af5b209c9f
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
2 changed files with 20 additions and 8 deletions

View file

@ -1544,10 +1544,27 @@ fn store_list_pattern<'a>(
}
}
stmt = store_list_rest(env, list_sym, list_arity, list_layout, opt_rest, stmt);
if is_productive {
StorePattern::Productive(stmt)
} else {
StorePattern::NotProductive(stmt)
}
}
fn store_list_rest<'a>(
env: &mut Env<'a, '_>,
list_sym: Symbol,
list_arity: ListArity,
list_layout: InLayout<'a>,
opt_rest: &Option<(usize, Option<Symbol>)>,
mut stmt: Stmt<'a>,
) -> Stmt<'a> {
if let Some((index, Some(rest_sym))) = opt_rest {
let usize_layout = Layout::usize(env.target_info);
let total_dropped = elements.len();
let total_dropped = list_arity.min_len();
let total_dropped_sym = env.unique_symbol();
let total_dropped_expr = Expr::Literal(Literal::Int((total_dropped as u128).to_ne_bytes()));
@ -1591,12 +1608,7 @@ fn store_list_pattern<'a>(
stmt = Stmt::Let(sym, expr, lay, env.arena.alloc(stmt));
}
}
if is_productive {
StorePattern::Productive(stmt)
} else {
StorePattern::NotProductive(stmt)
}
stmt
}
#[allow(clippy::too_many_arguments)]

View file

@ -47,7 +47,7 @@ impl<'a> SemanticRepr<'a> {
pub(super) const NONE: Self = Self(Inner::None);
pub(super) const EMPTY_RECORD: Self = Self::record(&[]);
pub(crate) const fn record(fields: &'a [&'a str]) -> Self {
pub(super) const fn record(fields: &'a [&'a str]) -> Self {
Self(Inner::Record(SemaRecord { fields }))
}