mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-17 01:55:07 +01:00
things
This commit is contained in:
parent
475a520de3
commit
683f11c997
6 changed files with 111 additions and 13 deletions
|
|
@ -262,3 +262,25 @@ pub enum ExternalDecl {
|
|||
}
|
||||
|
||||
pub type TranslationUnit = Vec<Spanned<ExternalDecl>>;
|
||||
|
||||
impl Decl {
|
||||
pub fn uwnrap_normal(&self) -> &NormalDecl {
|
||||
match self {
|
||||
Decl::Normal(decl) => decl,
|
||||
Decl::StaticAssert => {
|
||||
panic!("Expected normal declaration, found static assert declaration")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DirectDeclarator {
|
||||
pub fn unwrap_with_params(&self) -> (&Ident, &Vec<FunctionParamDecl>) {
|
||||
match self {
|
||||
DirectDeclarator::Ident(_) => {
|
||||
panic!("Expected declarator with parameters, found single identifier declarator1")
|
||||
}
|
||||
DirectDeclarator::WithParams { ident, params } => (ident, params),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue