backend: add const to ast

This commit is contained in:
Julius Rakow
2018-07-13 04:16:19 +02:00
parent 63598721ca
commit 862e4c50f6
5 changed files with 82 additions and 0 deletions

View File

@ -34,6 +34,7 @@ pub enum ImportKind {
Static(ImportStatic),
Type(ImportType),
Enum(ImportEnum),
Const(Const)
}
#[derive(Deserialize, Serialize)]
@ -124,6 +125,9 @@ pub struct StructField {
pub comments: Vec<String>,
}
#[derive(Deserialize, Serialize)]
pub struct Const {}
pub fn new_function(struct_name: &str) -> String {
let mut name = format!("__wbg_");
name.extend(struct_name.chars().flat_map(|s| s.to_lowercase()));