Commit d88ad8e5 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Fixed formatting of list constants (and deleted vector constants)

parent b8d15044
......@@ -1262,8 +1262,6 @@ pub enum Constant {
Double(f64),
/// function reference
FuncRef(MuEntityRef),
/// vector constant (currently not used)
Vector(Vec<Constant>),
/// null reference
NullRef,
/// external symbol
......@@ -1273,7 +1271,7 @@ pub enum Constant {
}
rodal_enum!(Constant{(Int: val), (IntEx: val), (Float: val), (Double: val), (FuncRef: val),
(Vector: val), NullRef, (ExternSym: val), (List: val)});
NullRef, (ExternSym: val), (List: val)});
impl fmt::Display for Constant {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
......@@ -1291,26 +1289,14 @@ impl fmt::Display for Constant {
&Constant::Double(v) => write!(f, "{}", v),
// &Constant::IRef(v) => write!(f, "{}", v),
&Constant::FuncRef(ref v) => write!(f, "{}", v.name),
&Constant::Vector(ref v) => {
// TODO: Make this Muc compatible?
write!(f, "[").unwrap();
for i in 0..v.len() {
write!(f, "{}", v[i]).unwrap();
if i != v.len() - 1 {
write!(f, ", ").unwrap();
}
}
write!(f, "]")
}
&Constant::NullRef => write!(f, "NULL"),
&Constant::ExternSym(ref name) => write!(f, "EXTERN \"{}\"", name),
&Constant::List(ref vec) => {
write!(f, "List(").unwrap();
write!(f, "{{")?;
for val in vec.iter() {
write!(f, "{}, ", val).unwrap();
write!(f, "{} ", val).unwrap();
}
write!(f, ")")
write!(f, "}}")
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment