Add empty_vararg literal to generate jump instruction.
This commit is contained in:
committed by
Nicolas B. Pierron
parent
614fb7b526
commit
0c1f17d6dd
@@ -111,6 +111,9 @@ pub(crate) enum Literal {
|
|||||||
|
|
||||||
/// A value of an integer immediate operand.
|
/// A value of an integer immediate operand.
|
||||||
Int(i64),
|
Int(i64),
|
||||||
|
|
||||||
|
/// A empty list of variable set of arguments.
|
||||||
|
EmptyVarArgs,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Literal {
|
impl Literal {
|
||||||
@@ -147,11 +150,16 @@ impl Literal {
|
|||||||
Literal::Int(value)
|
Literal::Int(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn empty_vararg() -> Self {
|
||||||
|
Literal::EmptyVarArgs
|
||||||
|
}
|
||||||
|
|
||||||
pub fn to_rust_code(&self) -> String {
|
pub fn to_rust_code(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
Literal::Enumerator { rust_type, value } => format!("{}::{}", rust_type, value),
|
Literal::Enumerator { rust_type, value } => format!("{}::{}", rust_type, value),
|
||||||
Literal::Bits { rust_type, value } => format!("{}::with_bits({:#x})", rust_type, value),
|
Literal::Bits { rust_type, value } => format!("{}::with_bits({:#x})", rust_type, value),
|
||||||
Literal::Int(val) => val.to_string(),
|
Literal::Int(val) => val.to_string(),
|
||||||
|
Literal::EmptyVarArgs => "&[]".into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,7 +396,7 @@ impl Apply {
|
|||||||
obtained enum value '{}'",
|
obtained enum value '{}'",
|
||||||
op.kind.name, value
|
op.kind.name, value
|
||||||
),
|
),
|
||||||
Literal::Bits { .. } | Literal::Int(_) => {}
|
Literal::Bits { .. } | Literal::Int(_) | Literal::EmptyVarArgs => {}
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
panic!(
|
panic!(
|
||||||
|
|||||||
Reference in New Issue
Block a user