webidl: initial enum support

Add enum support to the WebIDL interface generator.
This commit is contained in:
Stephan Wolski
2018-07-08 22:09:00 -04:00
parent 94d939f4da
commit a981dfd507
10 changed files with 239 additions and 12 deletions

View File

@ -105,6 +105,7 @@ impl ImportedTypes for ast::ImportKind {
ast::ImportKind::Static(s) => s.imported_types(f),
ast::ImportKind::Function(fun) => fun.imported_types(f),
ast::ImportKind::Type(ty) => ty.imported_types(f),
ast::ImportKind::Enum(enm) => enm.imported_types(f),
}
}
}
@ -210,6 +211,15 @@ impl ImportedTypes for ast::ImportType {
}
}
impl ImportedTypes for ast::ImportEnum {
fn imported_types<F>(&self, f: &mut F)
where
F: FnMut(&Ident, ImportedTypeKind),
{
f(&self.name, ImportedTypeKind::Definition);
}
}
impl ImportedTypes for ast::TypeAlias {
fn imported_types<F>(&self, f: &mut F)
where