1
Fork 0

syntax: don't keep a redundant c_variadic flag in the AST.

This commit is contained in:
Eduard-Mihai Burtescu 2019-08-10 13:29:39 +03:00
parent f3c8eba643
commit 8a9d775888
12 changed files with 22 additions and 19 deletions

View file

@ -1893,7 +1893,6 @@ impl Param {
pub struct FnDecl {
pub inputs: Vec<Param>,
pub output: FunctionRetTy,
pub c_variadic: bool,
}
impl FnDecl {
@ -1903,6 +1902,12 @@ impl FnDecl {
pub fn has_self(&self) -> bool {
self.inputs.get(0).map(Param::is_self).unwrap_or(false)
}
pub fn c_variadic(&self) -> bool {
self.inputs.last().map(|arg| match arg.ty.kind {
TyKind::CVarArgs => true,
_ => false,
}).unwrap_or(false)
}
}
/// Is the trait definition an auto trait?