mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-14 22:38:46 +00:00
Parse integral values, closes #289
This commit is contained in:
@@ -938,7 +938,14 @@ impl fmt::Display for Constant {
|
||||
value.to_string()
|
||||
}
|
||||
),
|
||||
Self::Float { value, .. } => write!(f, "{value}"),
|
||||
Self::Float { value, .. } => {
|
||||
let mut val_str = value.to_string();
|
||||
// For floats with integral values, ".0" is added.
|
||||
if !val_str.contains('.') {
|
||||
val_str += ".0"
|
||||
};
|
||||
write!(f, "{val_str}")
|
||||
}
|
||||
Self::GlobalVariable { name, .. } => write!(f, "@{name}"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user