From d6b6df5d1cfcdfb72d8e7c3c641aae42e3be321f Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Wed, 10 May 2023 21:31:02 +0900 Subject: [PATCH] ast::Int::to_usize --- ast/src/builtin.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ast/src/builtin.rs b/ast/src/builtin.rs index 4c8f929524..cd62f54cff 100644 --- a/ast/src/builtin.rs +++ b/ast/src/builtin.rs @@ -46,6 +46,9 @@ impl Int { pub fn to_u32(&self) -> u32 { self.0 } + pub fn to_usize(&self) -> usize { + self.0 as _ + } pub fn to_bool(&self) -> bool { self.0 > 0 }