Clean up file and repl support for Num.maxI128

This commit is contained in:
Eric Henry 2021-03-12 17:48:55 -05:00
parent 66f07d984e
commit 3e4eb8d839
3 changed files with 15 additions and 1 deletions

View file

@ -82,6 +82,14 @@ fn jit_to_ast_help<'a>(
content
)))
}
Layout::Builtin(Builtin::Int128) => {
Ok(run_jit_function!(
lib,
main_fn_name,
i128,
|num| num_to_ast(env, i128_to_ast(env.arena, num), content)
))
}
Layout::Builtin(Builtin::Float64) => {
Ok(run_jit_function!(lib, main_fn_name, f64, |num| num_to_ast(
env,
@ -852,6 +860,12 @@ fn i64_to_ast(arena: &Bump, num: i64) -> Expr<'_> {
Expr::Num(arena.alloc(format!("{}", num)))
}
/// This is centralized in case we want to format it differently later,
/// e.g. adding underscores for large numbers
fn i128_to_ast(arena: &Bump, num: i128) -> Expr<'_> {
Expr::Num(arena.alloc(format!("{}", num)))
}
/// This is centralized in case we want to format it differently later,
/// e.g. adding underscores for large numbers
fn f64_to_ast(arena: &Bump, num: f64) -> Expr<'_> {