Commit d0fa4c9c authored by Federico Mena Quintero's avatar Federico Mena Quintero Comment on how to fix the code for property type conversions

parent 28fa021e
Pipeline #14774 failed with stages
in 3 minutes and 17 seconds
......@@ -68,6 +68,16 @@ pub fn property_getter<'ast>(properties: &[Property<'ast>]) -> TokenStream {
let type_ = prop.type_;
let body = prop.getter;
// FIXME: (type conversions) The new quote/syn don't have into_tokens() anymore.
// What the following code does is to stringify the prop.type_ and then match on
// the stringified type name. Instead, we need to do something similar to what
// the signals code does. See where hir/ calls
// hir::Ty::extract_from_type(syn::Type). We should do that, and if it succeeds
// (it means we know how to represent the type as a GType), then take further
// action.
// Instead of deciding on the value's type by hand here, to then call g_value_set_foo(),
// maybe we can do that with one of glib-rs's built-in conversions?
let type_token_tree: TokenTree = prop.type_.into_tokens().into_iter().nth(0).unwrap();
let tname = match type_token_tree {
TokenTree::Ident(i) => i.to_string(),
......@@ -223,6 +233,7 @@ fn prop_registration<'ast>(properties: &[Property<'ast>]) -> Vec<TokenStream> {
let para_spec;
let default;
// FIXME: grep for (type conversions) above; that has a description of how to fix this.
let type_token_tree: TokenTree = prop.type_.into_tokens().into_iter().nth(0).unwrap();
let type_ = match type_token_tree {
TokenTree::Ident(i) => i.to_string(),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment