Class items, struct items, enum items, mapping
This commit is contained in:
@@ -59,3 +59,9 @@ impl From<GenericDecl> for Generic {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Spanned<T> {
|
||||
pub fn get_comment(&self) -> String {
|
||||
format!("/* {}:{} */", self.line, self.column)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,29 +41,29 @@ pub enum TopLevelKind {
|
||||
visibility: Visibility,
|
||||
name: Identifier,
|
||||
generics: GenericsDecl,
|
||||
fields: Vec<EnumItem>,
|
||||
fields: Vec<Spanned<EnumItem>>,
|
||||
},
|
||||
StructDecl {
|
||||
visibility: Visibility,
|
||||
name: Identifier,
|
||||
generics: GenericsDecl,
|
||||
fields: Vec<FieldDecl>,
|
||||
fields: Vec<Spanned<FieldDecl>>,
|
||||
},
|
||||
FunctionDecl(FunctionDecl),
|
||||
ClassDecl {
|
||||
visibility: Visibility,
|
||||
name: Identifier,
|
||||
generics: GenericsDecl,
|
||||
fields: Vec<FieldDeclStmt>,
|
||||
constructor: ClassConstructor,
|
||||
fields: Vec<Spanned<FieldDeclStmt>>,
|
||||
constructor: Spanned<ClassConstructor>,
|
||||
items: Vec<ClassItem>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub enum ClassItem {
|
||||
Method(FunctionDecl),
|
||||
ImplDecl(ImplDecl),
|
||||
Method(Spanned<FunctionDecl>),
|
||||
ImplDecl(Spanned<ImplDecl>),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Default)]
|
||||
|
||||
Reference in New Issue
Block a user