Make header a vec of modifiers, make FunctionPointer consistent with Function and Method.

This commit is contained in:
Rune Tynan
2021-02-08 13:48:10 -05:00
parent 36ecbc94eb
commit a26fa74d3c
7 changed files with 85 additions and 16 deletions

View File

@@ -281,11 +281,20 @@ pub enum StructType {
Unit,
}
#[non_exhaustive]
#[serde(rename_all = "snake_case")]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub enum Modifiers {
Const,
Unsafe,
Async,
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Function {
pub decl: FnDecl,
pub generics: Generics,
pub header: String,
pub header: Vec<Modifiers>,
pub abi: String,
}
@@ -293,7 +302,7 @@ pub struct Function {
pub struct Method {
pub decl: FnDecl,
pub generics: Generics,
pub header: String,
pub header: Vec<Modifiers>,
pub abi: String,
pub has_body: bool,
}
@@ -404,9 +413,9 @@ pub enum Type {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct FunctionPointer {
pub is_unsafe: bool,
pub generic_params: Vec<GenericParamDef>,
pub decl: FnDecl,
pub generic_params: Vec<GenericParamDef>,
pub header: Vec<Modifiers>,
pub abi: String,
}