From eb2ac4c82b97ea35b9bb1e67f81f9f9073bd8a93 Mon Sep 17 00:00:00 2001 From: Brian Carroll Date: Mon, 4 Jul 2022 15:07:12 +0100 Subject: [PATCH] module: delete LowLevel enum variant ListMapWithIndex --- crates/compiler/gen_llvm/src/llvm/build.rs | 2 +- crates/compiler/gen_wasm/src/low_level.rs | 2 +- crates/compiler/module/src/low_level.rs | 5 +---- crates/compiler/mono/src/borrow.rs | 2 +- crates/compiler/mono/src/ir.rs | 6 ------ 5 files changed, 4 insertions(+), 13 deletions(-) diff --git a/crates/compiler/gen_llvm/src/llvm/build.rs b/crates/compiler/gen_llvm/src/llvm/build.rs index 06b6c1ee05..0f9f042490 100644 --- a/crates/compiler/gen_llvm/src/llvm/build.rs +++ b/crates/compiler/gen_llvm/src/llvm/build.rs @@ -5976,7 +5976,7 @@ fn run_low_level<'a, 'ctx, 'env>( set } - ListMap | ListMap2 | ListMap3 | ListMap4 | ListMapWithIndex | ListSortWith | DictWalk => { + ListMap | ListMap2 | ListMap3 | ListMap4 | ListSortWith | DictWalk => { unreachable!("these are higher order, and are handled elsewhere") } diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index f5a81afe5e..032765e1d9 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -301,7 +301,7 @@ impl<'a> LowLevelCall<'a> { ListIsUnique => self.load_args_and_call_zig(backend, bitcode::LIST_IS_UNIQUE), - ListMap | ListMap2 | ListMap3 | ListMap4 | ListMapWithIndex | ListSortWith + ListMap | ListMap2 | ListMap3 | ListMap4 | ListSortWith | DictWalk => { internal_error!("HigherOrder lowlevels should not be handled here") } diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index d008fcf4b7..18d379b9d5 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -35,7 +35,6 @@ pub enum LowLevel { ListMap2, ListMap3, ListMap4, - ListMapWithIndex, ListSortWith, ListSublist, ListDropAt, @@ -120,7 +119,7 @@ pub enum LowLevel { macro_rules! higher_order { () => { - ListMap | ListMap2 | ListMap3 | ListMap4 | ListMapWithIndex | ListSortWith | DictWalk + ListMap | ListMap2 | ListMap3 | ListMap4 | ListSortWith | DictWalk }; } @@ -141,7 +140,6 @@ impl LowLevel { ListMap2 => 2, ListMap3 => 3, ListMap4 => 4, - ListMapWithIndex => 1, ListSortWith => 1, DictWalk => 2, _ => unreachable!(), @@ -206,7 +204,6 @@ impl LowLevelWrapperType { Symbol::LIST_MAP2 => WrapperIsRequired, Symbol::LIST_MAP3 => WrapperIsRequired, Symbol::LIST_MAP4 => WrapperIsRequired, - Symbol::LIST_MAP_WITH_INDEX => WrapperIsRequired, Symbol::LIST_SORT_WITH => WrapperIsRequired, Symbol::LIST_SUBLIST => WrapperIsRequired, Symbol::LIST_DROP_AT => CanBeReplacedBy(ListDropAt), diff --git a/crates/compiler/mono/src/borrow.rs b/crates/compiler/mono/src/borrow.rs index 3ec6f0f689..46aa193573 100644 --- a/crates/compiler/mono/src/borrow.rs +++ b/crates/compiler/mono/src/borrow.rs @@ -906,7 +906,7 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[bool] { StrToNum => arena.alloc_slice_copy(&[borrowed]), ListPrepend => arena.alloc_slice_copy(&[owned, owned]), StrJoinWith => arena.alloc_slice_copy(&[borrowed, borrowed]), - ListMap | ListMapWithIndex => arena.alloc_slice_copy(&[owned, function, closure_data]), + ListMap => arena.alloc_slice_copy(&[owned, function, closure_data]), ListMap2 => arena.alloc_slice_copy(&[owned, owned, function, closure_data]), ListMap3 => arena.alloc_slice_copy(&[owned, owned, owned, function, closure_data]), ListMap4 => arena.alloc_slice_copy(&[owned, owned, owned, owned, function, closure_data]), diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index f38e2c3082..526890cde3 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -5108,12 +5108,6 @@ pub fn with_hole<'a>( let xs = arg_symbols[0]; match_on_closure_argument!(ListMap, [xs]) } - - ListMapWithIndex => { - debug_assert_eq!(arg_symbols.len(), 2); - let xs = arg_symbols[0]; - match_on_closure_argument!(ListMapWithIndex, [xs]) - } ListSortWith => { debug_assert_eq!(arg_symbols.len(), 2); let xs = arg_symbols[0];