mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Revert "code that makes new NewHigherOrderLowLevels, use this later"
This reverts commit 2c702cc893
.
This commit is contained in:
parent
2c702cc893
commit
5052fe68a4
1 changed files with 4 additions and 108 deletions
|
@ -4041,128 +4041,24 @@ pub fn with_hole<'a>(
|
||||||
let layout =
|
let layout =
|
||||||
return_on_layout_error!(env, layout_cache.from_var(env.arena, ret_var, env.subs));
|
return_on_layout_error!(env, layout_cache.from_var(env.arena, ret_var, env.subs));
|
||||||
|
|
||||||
let closure_data_symbol = arg_symbols[2];
|
|
||||||
|
|
||||||
macro_rules! new_match_on_closure_argument {
|
|
||||||
($env:expr, $procs:expr, $layout_cache:expr, $closure_data_symbol:expr, $closure_data_var:expr, $op:expr, $ho:ident, [$($x:ident),* $(,)?], $layout: expr, $assigned:expr, $hole:expr) => {{
|
|
||||||
let closure_data_layout = return_on_layout_error!(
|
|
||||||
$env,
|
|
||||||
$layout_cache.raw_from_var($env.arena, $closure_data_var, $env.subs)
|
|
||||||
);
|
|
||||||
|
|
||||||
let top_level = ProcLayout::from_raw($env.arena, closure_data_layout);
|
|
||||||
|
|
||||||
let arena = $env.arena;
|
|
||||||
|
|
||||||
let arg_layouts = top_level.arguments;
|
|
||||||
let ret_layout = top_level.result;
|
|
||||||
|
|
||||||
match closure_data_layout {
|
|
||||||
RawFunctionLayout::Function(_, lambda_set, _) => {
|
|
||||||
lowlevel_match_on_lambda_set(
|
|
||||||
$env,
|
|
||||||
lambda_set,
|
|
||||||
$op,
|
|
||||||
$closure_data_symbol,
|
|
||||||
|top_level_function, closure_data, closure_env_layout, specialization_id| self::Call {
|
|
||||||
call_type: CallType::NewHigherOrderLowLevel {
|
|
||||||
op: $ho { $($x,)* },
|
|
||||||
closure_env_layout,
|
|
||||||
specialization_id,
|
|
||||||
function_owns_closure_data: false,
|
|
||||||
function_env: closure_data_symbol,
|
|
||||||
function_name: top_level_function,
|
|
||||||
arg_layouts,
|
|
||||||
ret_layout,
|
|
||||||
},
|
|
||||||
arguments: arena.alloc([$($x,)* top_level_function, closure_data]),
|
|
||||||
},
|
|
||||||
$layout,
|
|
||||||
$assigned,
|
|
||||||
$hole,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
RawFunctionLayout::ZeroArgumentThunk(_) => unreachable!("match_on_closure_argument received a zero-argument thunk"),
|
|
||||||
}
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
use LowLevel::*;
|
use LowLevel::*;
|
||||||
match op {
|
match op {
|
||||||
ListMap => {
|
ListMap | ListMapWithIndex | ListKeepIf | ListKeepOks | ListKeepErrs
|
||||||
debug_assert_eq!(arg_symbols.len(), 2);
|
| ListSortWith => {
|
||||||
|
|
||||||
let closure_index = 1;
|
|
||||||
let closure_data_symbol = arg_symbols[closure_index];
|
|
||||||
let closure_data_var = args[closure_index].0;
|
|
||||||
let xs = arg_symbols[0];
|
|
||||||
|
|
||||||
let closure_data_layout = return_on_layout_error!(
|
|
||||||
env,
|
|
||||||
layout_cache.raw_from_var(env.arena, closure_data_var, env.subs)
|
|
||||||
);
|
|
||||||
|
|
||||||
let top_level = ProcLayout::from_raw(env.arena, closure_data_layout);
|
|
||||||
|
|
||||||
let arena = env.arena;
|
|
||||||
|
|
||||||
let arg_layouts = top_level.arguments;
|
|
||||||
let ret_layout = top_level.result;
|
|
||||||
|
|
||||||
match closure_data_layout {
|
|
||||||
RawFunctionLayout::Function(_, lambda_set, _) => {
|
|
||||||
lowlevel_match_on_lambda_set(
|
|
||||||
env,
|
|
||||||
lambda_set,
|
|
||||||
op,
|
|
||||||
closure_data_symbol,
|
|
||||||
|top_level_function,
|
|
||||||
closure_data,
|
|
||||||
closure_env_layout,
|
|
||||||
specialization_id| self::Call {
|
|
||||||
call_type: CallType::NewHigherOrderLowLevel {
|
|
||||||
op: crate::low_level::HigherOrder::ListMap { xs },
|
|
||||||
closure_env_layout,
|
|
||||||
specialization_id,
|
|
||||||
function_owns_closure_data: false,
|
|
||||||
function_env: closure_data_symbol,
|
|
||||||
function_name: top_level_function,
|
|
||||||
arg_layouts,
|
|
||||||
ret_layout,
|
|
||||||
},
|
|
||||||
arguments: arena.alloc([xs, top_level_function, closure_data]),
|
|
||||||
},
|
|
||||||
layout,
|
|
||||||
assigned,
|
|
||||||
hole,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
RawFunctionLayout::ZeroArgumentThunk(_) => {
|
|
||||||
unreachable!("match_on_closure_argument received a zero-argument thunk")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListMapWithIndex | ListKeepIf | ListKeepOks | ListKeepErrs | ListSortWith => {
|
|
||||||
debug_assert_eq!(arg_symbols.len(), 2);
|
debug_assert_eq!(arg_symbols.len(), 2);
|
||||||
|
|
||||||
let closure_index = 1;
|
let closure_index = 1;
|
||||||
let closure_data_symbol = arg_symbols[closure_index];
|
let closure_data_symbol = arg_symbols[closure_index];
|
||||||
let closure_data_var = args[closure_index].0;
|
let closure_data_var = args[closure_index].0;
|
||||||
|
|
||||||
let xs = arg_symbols[0];
|
match_on_closure_argument!(
|
||||||
|
|
||||||
use crate::low_level::HigherOrder::ListMapWithIndex;
|
|
||||||
|
|
||||||
new_match_on_closure_argument!(
|
|
||||||
env,
|
env,
|
||||||
procs,
|
procs,
|
||||||
layout_cache,
|
layout_cache,
|
||||||
closure_data_symbol,
|
closure_data_symbol,
|
||||||
closure_data_var,
|
closure_data_var,
|
||||||
op,
|
op,
|
||||||
ListMapWithIndex,
|
[arg_symbols[0]],
|
||||||
[xs],
|
|
||||||
layout,
|
layout,
|
||||||
assigned,
|
assigned,
|
||||||
hole
|
hole
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue