mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
misc cleanup suggestions
This commit is contained in:
parent
2ef97fc5a1
commit
af5b209c9f
2 changed files with 20 additions and 8 deletions
|
@ -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)]
|
||||
|
|
|
@ -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 }))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue