diff options
author | Son HO | 2024-04-26 10:55:47 +0200 |
---|---|---|
committer | GitHub | 2024-04-26 10:55:47 +0200 |
commit | 5da597289c1723aa59bf87ad5075675820c18f73 (patch) | |
tree | d63e2f44c75634674a3e4eabb57ff08c0ae441ac /compiler | |
parent | 2df6dd65b84a2fd9aad4f716f323bf3f85bf82db (diff) | |
parent | fe8d14cd8b7ba907d5248d574619e93e6d1d253a (diff) |
Merge pull request #125 from zhassan-aws/core-option-unwrap
Add `core::option::unwrap` builtin
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ExtractBuiltin.ml | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/ExtractBuiltin.ml b/compiler/ExtractBuiltin.ml index c6827bbe..a7ab6da0 100644 --- a/compiler/ExtractBuiltin.ml +++ b/compiler/ExtractBuiltin.ml @@ -387,6 +387,8 @@ let builtin_funs () : (pattern * bool list option * builtin_fun_info) list = @A>>}::deref_mut" (Some "alloc.vec.DerefMutVec.deref_mut") (Some [ true; false ]); + mk_fun "core::option::{core::option::Option<@T>}::unwrap" + (Some "core.option.Option.unwrap") None; ] @ List.flatten (List.map @@ -552,14 +554,17 @@ let builtin_fun_effects = (fun n -> (n, { can_fail = false; stateful = false })) no_fail_no_state_funs in + (* TODO: all the functions registered in the [builtin_funs] above should + be considered as not using a state. There is a lot of redundancy + right now. *) let no_state_funs = [ - (* TODO: redundancy with the funs information above *) "alloc::vec::{alloc::vec::Vec<@T, @A>}::push"; "alloc::vec::{core::ops::index::Index<alloc::vec::Vec<@T, @A>, \ @I>}::index"; "alloc::vec::{core::ops::index::IndexMut<alloc::vec::Vec<@T, @A>, \ @I>}::index_mut"; + "core::option::{core::option::Option<@T>}::unwrap"; ] in let no_state_funs = |