mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
trying to make Str.toNum work for Ints
This commit is contained in:
parent
2e21fd0cb9
commit
e63701c5d1
6 changed files with 6 additions and 15 deletions
|
@ -5269,6 +5269,7 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
str_ends_with(env, scope, args[0], args[1])
|
||||
}
|
||||
StrToNum => {
|
||||
// Str.toNum : Str -> Result (Num *) {}
|
||||
debug_assert_eq!(args.len(), 1);
|
||||
|
||||
let (string, _string_layout) = load_symbol_and_layout(scope, &args[0]);
|
||||
|
|
|
@ -441,13 +441,3 @@ pub fn empty_str<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> BasicValueEnum<'c
|
|||
// so the whole struct should be a const_zero
|
||||
BasicValueEnum::StructValue(struct_type.const_zero())
|
||||
}
|
||||
|
||||
/// Str.toNum : Str -> Result (Num a) [ ExpectedNum a ]*
|
||||
pub fn str_to_num<'a, 'ctx, 'env>(
|
||||
env: &Env<'a, 'ctx, 'env>,
|
||||
scope: &Scope<'a, 'ctx>,
|
||||
str_symbol: Symbol,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
let str_i128 = str_symbol_to_c_abi(env, scope, str_symbol);
|
||||
call_bitcode_fn(env, &[str_i128.into()], bitcode::STR_TRIM_RIGHT)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue