Lookup of identifier is now done while resolving expressions

This commit is contained in:
Olivier Goffart 2020-05-25 14:36:24 +02:00
parent e6bed90ced
commit 1de4eb476b
6 changed files with 116 additions and 57 deletions

View file

@ -141,13 +141,11 @@ pub fn sixtyfps(stream: TokenStream) -> TokenStream {
for (k, v) in &item.init_properties {
let k = quote::format_ident!("{}", k);
let v = match v {
Expression::Invalid | Expression::Uncompiled(_) => quote!(),
// That's an error
Expression::Identifier(_) => quote!(),
Expression::StringLiteral(s) => {
quote!(sixtyfps::re_exports::SharedString::from(#s))
}
Expression::NumberLiteral(n) => quote!(#n),
_ => quote!(compile_error! {"unsupported expression"}),
};
init.push(quote!(self_.#field_name.#k.set(#v as _);));
}