cl-typeck: Add isize/usize primitives

This commit is contained in:
John 2024-05-04 23:07:57 -05:00
parent d2eb165759
commit a89f45aa58
2 changed files with 8 additions and 0 deletions

View File

@ -148,6 +148,8 @@ pub enum Intrinsic {
I64, I64,
// /// A 128-bit signed integer: `#[intrinsic = "i32"]` // /// A 128-bit signed integer: `#[intrinsic = "i32"]`
// I128, // I128,
/// A ptr-len signed integer: `#[intrinsic = "isize"]`
Isize,
/// An 8-bit unsigned integer: `#[intrinsic = "u8"]` /// An 8-bit unsigned integer: `#[intrinsic = "u8"]`
U8, U8,
/// A 16-bit unsigned integer: `#[intrinsic = "u16"]` /// A 16-bit unsigned integer: `#[intrinsic = "u16"]`
@ -158,6 +160,8 @@ pub enum Intrinsic {
U64, U64,
// /// A 128-bit unsigned integer: `#[intrinsic = "u128"]` // /// A 128-bit unsigned integer: `#[intrinsic = "u128"]`
// U128, // U128,
/// A ptr-len unsigned integer: `#[intrinsic = "isize"]`
Usize,
/// A boolean (`true` or `false`): `#[intrinsic = "bool"]` /// A boolean (`true` or `false`): `#[intrinsic = "bool"]`
Bool, Bool,
/// The unicode codepoint type: #[intrinsic = "char"] /// The unicode codepoint type: #[intrinsic = "char"]
@ -173,10 +177,12 @@ impl FromStr for Intrinsic {
"i16" => Intrinsic::I16, "i16" => Intrinsic::I16,
"i32" => Intrinsic::I32, "i32" => Intrinsic::I32,
"i64" => Intrinsic::I64, "i64" => Intrinsic::I64,
"isize" => Intrinsic::Isize,
"u8" => Intrinsic::U8, "u8" => Intrinsic::U8,
"u16" => Intrinsic::U16, "u16" => Intrinsic::U16,
"u32" => Intrinsic::U32, "u32" => Intrinsic::U32,
"u64" => Intrinsic::U64, "u64" => Intrinsic::U64,
"usize" => Intrinsic::Usize,
"bool" => Intrinsic::Bool, "bool" => Intrinsic::Bool,
"char" => Intrinsic::Char, "char" => Intrinsic::Char,
_ => Err(())?, _ => Err(())?,

View File

@ -160,10 +160,12 @@ impl Display for Intrinsic {
Intrinsic::I16 => f.write_str("i16"), Intrinsic::I16 => f.write_str("i16"),
Intrinsic::I32 => f.write_str("i32"), Intrinsic::I32 => f.write_str("i32"),
Intrinsic::I64 => f.write_str("i64"), Intrinsic::I64 => f.write_str("i64"),
Intrinsic::Isize => f.write_str("isize"),
Intrinsic::U8 => f.write_str("u8"), Intrinsic::U8 => f.write_str("u8"),
Intrinsic::U16 => f.write_str("u16"), Intrinsic::U16 => f.write_str("u16"),
Intrinsic::U32 => f.write_str("u32"), Intrinsic::U32 => f.write_str("u32"),
Intrinsic::U64 => f.write_str("u64"), Intrinsic::U64 => f.write_str("u64"),
Intrinsic::Usize => f.write_str("usize"),
Intrinsic::Bool => f.write_str("bool"), Intrinsic::Bool => f.write_str("bool"),
Intrinsic::Char => f.write_str("char"), Intrinsic::Char => f.write_str("char"),
} }