Add IntValue type alias for backend integer values

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-10-20 13:10:53 -07:00
parent d449632c5b
commit 9169f5970e
4 changed files with 10 additions and 9 deletions

View File

@@ -56,7 +56,7 @@ impl Compile {
}
/// Gets or inserts a static int reference.
pub fn const_int(&mut self, int: i64) -> (ConstHandle, IntRef) {
pub fn const_int(&mut self, int: IntValue) -> (ConstHandle, IntRef) {
self.const_data_mut().const_int(int)
}
@@ -115,14 +115,14 @@ impl Compile {
/// This distinguishes between the different types while building a const pool to avoid duplicates.
#[derive(Debug, Default)]
pub struct ConstData {
ints: HashMap<i64, (ConstHandle, IntRef)>,
ints: HashMap<IntValue, (ConstHandle, IntRef)>,
strs: HashMap<String, (ConstHandle, StrRef)>,
const_pool: ConstPool,
}
impl ConstData {
/// Gets or inserts a static int reference.
pub fn const_int(&mut self, int: i64) -> (ConstHandle, IntRef) {
pub fn const_int(&mut self, int: IntValue) -> (ConstHandle, IntRef) {
if let Some(pair) = self.ints.get(&int) {
pair.clone()
} else {