mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
feat: switch to using a builtin per num type to convert from a string
This commit is contained in:
parent
bc5b1abcba
commit
e587e20de2
6 changed files with 122 additions and 25 deletions
|
@ -409,6 +409,40 @@ fn float_alias_content(range: SolvedType) -> SolvedType {
|
|||
num_type(floatingpoint_type(range))
|
||||
}
|
||||
|
||||
// F64
|
||||
|
||||
#[inline(always)]
|
||||
pub fn f64_type() -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_F64,
|
||||
vec![],
|
||||
vec![],
|
||||
Box::new(f64_alias_content()),
|
||||
)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn f64_alias_content() -> SolvedType {
|
||||
float_alias_content(binary64_type())
|
||||
}
|
||||
|
||||
// F32
|
||||
|
||||
#[inline(always)]
|
||||
pub fn f32_type() -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_F32,
|
||||
vec![],
|
||||
vec![],
|
||||
Box::new(f32_alias_content()),
|
||||
)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn f32_alias_content() -> SolvedType {
|
||||
float_alias_content(binary32_type())
|
||||
}
|
||||
|
||||
// Nat
|
||||
|
||||
#[inline(always)]
|
||||
|
@ -731,6 +765,23 @@ fn decimal_alias_content() -> SolvedType {
|
|||
single_private_tag(Symbol::NUM_AT_DECIMAL, vec![])
|
||||
}
|
||||
|
||||
// Dec
|
||||
|
||||
#[inline(always)]
|
||||
pub fn dec_type() -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
Symbol::NUM_DEC,
|
||||
vec![],
|
||||
vec![],
|
||||
Box::new(dec_alias_content()),
|
||||
)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn dec_alias_content() -> SolvedType {
|
||||
float_alias_content(decimal_type())
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn decimal_type() -> SolvedType {
|
||||
SolvedType::Alias(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue