1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
use std::collections::HashMap;
pub struct Field;
pub struct ComponentBuilder {
// static
name_cache: HashMap<String, String>, // = HashMap<String,String>::new();
// static
next_id: u32,
}
impl ComponentBuilder {
// // static
// pub fn build(&self) -> Vec<Field> {
// let pos = Context::currentPos();
// let cl = Context::getLocalClass().get();
// let name = Context::makeExpr(self.getComponentName(cl), pos);
// // let componentType = TPath({pack: cl.pack, name: cl.name, params: []});
// // let fields = Macros.buildFields(macro {
// // let public__static__inline__NAME = $name;
// // });
// // // Only override get_name if this component directly extends a componentBase and creates a
// // // new namespace
// // if (extendsComponentBase(cl)) {
// // fields = fields.concat(Macros.buildFields(macro {
// // fn override__private__get_name () ->String {
// // return $name;
// // }
// // }));
// // }
// // return fields.concat(Context.getBuildFields());
// unimplemented!()
// }
// static
// fn getComponentName(&self, cl: ClassType) -> String {
// // Traverse up to the last non-component base
// loop {
// if Self::extendsComponentBase(cl) {
// break;
// }
// cl = cl.superClass.t.get();
// }
// // Look up the ID, otherwise generate one
// let fullName = cl.pack.concat([cl.name]).join(".");
// let name = self._nameCache.get(fullName);
// if name.is_none() {
// name = cl.name + "_" + self._nextId;
// self._nameCache.set(fullName, name);
// self._nextId += 1;
// }
// name
// }
// // static
// fn extendsComponentBase(cl: ClassType) {
// let superClass = cl.superClass.t.get();
// superClass.meta.has(":componentBase")
// }
}