mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
clippy
This commit is contained in:
parent
26afbbe8f6
commit
2fb093d4c8
1 changed files with 52 additions and 56 deletions
|
@ -1,7 +1,7 @@
|
|||
use crate::ir::{substitute_in_exprs, Env, Expr, Procs, Stmt};
|
||||
use crate::layout::{
|
||||
self, Builtin, InLayout, LambdaName, Layout, LayoutCache, LayoutInterner, LayoutProblem,
|
||||
LayoutRepr, LayoutWrapper, SemanticRepr, TagIdIntType, UnionLayout, WrappedVariant,
|
||||
self, Builtin, InLayout, Layout, LayoutCache, LayoutInterner, LayoutProblem, LayoutRepr,
|
||||
TagIdIntType, UnionLayout, WrappedVariant,
|
||||
};
|
||||
use bumpalo::collections::Vec;
|
||||
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
||||
|
@ -1544,66 +1544,62 @@ fn store_list_pattern<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
match opt_rest {
|
||||
Some((index, Some(rest_sym))) => {
|
||||
let usize_layout = Layout::usize(env.target_info);
|
||||
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 = elements.len();
|
||||
|
||||
let total_dropped_sym = env.unique_symbol();
|
||||
let total_dropped_expr =
|
||||
Expr::Literal(Literal::Int((total_dropped as u128).to_ne_bytes()));
|
||||
let total_dropped_sym = env.unique_symbol();
|
||||
let total_dropped_expr = Expr::Literal(Literal::Int((total_dropped as u128).to_ne_bytes()));
|
||||
|
||||
let list_len_sym = env.unique_symbol();
|
||||
let list_len_expr = Expr::Call(Call {
|
||||
call_type: CallType::LowLevel {
|
||||
op: LowLevel::ListLen,
|
||||
update_mode: env.next_update_mode_id(),
|
||||
},
|
||||
arguments: env.arena.alloc([list_sym]),
|
||||
});
|
||||
let list_len_sym = env.unique_symbol();
|
||||
let list_len_expr = Expr::Call(Call {
|
||||
call_type: CallType::LowLevel {
|
||||
op: LowLevel::ListLen,
|
||||
update_mode: env.next_update_mode_id(),
|
||||
},
|
||||
arguments: env.arena.alloc([list_sym]),
|
||||
});
|
||||
|
||||
let rest_len_sym = env.unique_symbol();
|
||||
let rest_len_expr = Expr::Call(Call {
|
||||
call_type: CallType::LowLevel {
|
||||
op: LowLevel::NumSub,
|
||||
update_mode: env.next_update_mode_id(),
|
||||
},
|
||||
arguments: env.arena.alloc([list_len_sym, total_dropped_sym]),
|
||||
});
|
||||
let rest_len_sym = env.unique_symbol();
|
||||
let rest_len_expr = Expr::Call(Call {
|
||||
call_type: CallType::LowLevel {
|
||||
op: LowLevel::NumSub,
|
||||
update_mode: env.next_update_mode_id(),
|
||||
},
|
||||
arguments: env.arena.alloc([list_len_sym, total_dropped_sym]),
|
||||
});
|
||||
|
||||
let start_sym = env.unique_symbol();
|
||||
let start_expr = Expr::Literal(Literal::Int((*index as u128).to_ne_bytes()));
|
||||
let start_sym = env.unique_symbol();
|
||||
let start_expr = Expr::Literal(Literal::Int((*index as u128).to_ne_bytes()));
|
||||
|
||||
let rest_expr = Expr::Call(Call {
|
||||
call_type: CallType::LowLevel {
|
||||
op: LowLevel::ListSublist,
|
||||
update_mode: env.next_update_mode_id(),
|
||||
},
|
||||
arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]),
|
||||
});
|
||||
stmt = Stmt::Let(*rest_sym, rest_expr, list_layout, env.arena.alloc(stmt));
|
||||
stmt = Stmt::Let(start_sym, start_expr, usize_layout, env.arena.alloc(stmt));
|
||||
stmt = Stmt::Let(
|
||||
rest_len_sym,
|
||||
rest_len_expr,
|
||||
usize_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
stmt = Stmt::Let(
|
||||
list_len_sym,
|
||||
list_len_expr,
|
||||
usize_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
stmt = Stmt::Let(
|
||||
total_dropped_sym,
|
||||
total_dropped_expr,
|
||||
usize_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
}
|
||||
_ => {}
|
||||
let rest_expr = Expr::Call(Call {
|
||||
call_type: CallType::LowLevel {
|
||||
op: LowLevel::ListSublist,
|
||||
update_mode: env.next_update_mode_id(),
|
||||
},
|
||||
arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]),
|
||||
});
|
||||
stmt = Stmt::Let(*rest_sym, rest_expr, list_layout, env.arena.alloc(stmt));
|
||||
stmt = Stmt::Let(start_sym, start_expr, usize_layout, env.arena.alloc(stmt));
|
||||
stmt = Stmt::Let(
|
||||
rest_len_sym,
|
||||
rest_len_expr,
|
||||
usize_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
stmt = Stmt::Let(
|
||||
list_len_sym,
|
||||
list_len_expr,
|
||||
usize_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
stmt = Stmt::Let(
|
||||
total_dropped_sym,
|
||||
total_dropped_expr,
|
||||
usize_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
}
|
||||
|
||||
if is_productive {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue