Backend refactor (#411)

* remove BindgenAttrs from other backend::ast structs

This is primarily a tool for use with the macro crate. Most of
these attributes were ignored in the actual codegen, but a few
were still being used. This is confusing when trying to add
other sources for codegen (such as webidl and typescript).

* move parsing logic to macro crate

This makes the backend crate solely concerned with having an ast
for which we can generate code.
This commit is contained in:
R. Andrew Ohana
2018-07-07 10:20:31 -07:00
committed by Alex Crichton
parent 056b45aeed
commit 2d50d5209b
10 changed files with 1095 additions and 1053 deletions

View File

@ -1,7 +1,7 @@
#[macro_use]
extern crate serde_derive;
pub const SCHEMA_VERSION: &str = "5";
pub const SCHEMA_VERSION: &str = "6";
#[derive(Deserialize)]
pub struct ProgramOnlySchema {
@ -48,15 +48,25 @@ pub struct ImportFunction {
pub struct MethodData {
pub class: String,
pub kind: MethodKind,
pub getter: Option<String>,
pub setter: Option<String>,
}
#[derive(Deserialize, Serialize)]
pub enum MethodKind {
Normal,
Constructor,
Static,
Operation(Operation),
}
#[derive(Deserialize, Serialize)]
pub struct Operation {
pub is_static: bool,
pub kind: OperationKind,
}
#[derive(Deserialize, Serialize)]
pub enum OperationKind {
Regular,
Getter(String),
Setter(String),
}
#[derive(Deserialize, Serialize)]