Skip to content

Commit

Permalink
Try #777:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Aug 30, 2021
2 parents 21373fc + a048fc4 commit feb1ab7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gdnative-derive/src/native_script.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use proc_macro::TokenStream;
use proc_macro2::TokenStream as TokenStream2;

use std::collections::HashMap;
use syn::spanned::Spanned;
use syn::{Data, DeriveInput, Fields, Ident, Meta, MetaList, NestedMeta, Path, Stmt, Type};

Expand All @@ -13,7 +12,7 @@ pub(crate) struct DeriveData {
pub(crate) base: Type,
pub(crate) register_callback: Option<Path>,
pub(crate) user_data: Type,
pub(crate) properties: HashMap<Ident, PropertyAttrArgs>,
pub(crate) properties: Vec<(Ident, PropertyAttrArgs)>,
pub(crate) no_constructor: bool,
}

Expand Down Expand Up @@ -185,7 +184,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
};

// Find all fields with a `#[property]` attribute
let mut properties = HashMap::new();
let mut properties = Vec::new();

if let Fields::Named(names) = &struct_data.fields {
for field in &names.named {
Expand Down Expand Up @@ -229,7 +228,7 @@ fn parse_derive_input(input: &DeriveInput) -> Result<DeriveData, syn::Error> {
.ident
.clone()
.ok_or_else(|| syn::Error::new(field.ident.span(), "Fields should be named"))?;
properties.insert(ident, builder.done());
properties.push((ident, builder.done()));
}
}
};
Expand Down

0 comments on commit feb1ab7

Please sign in to comment.