improve storage macro static checks (#1907)

This commit is contained in:
thiolliere
2019-03-01 12:19:24 +01:00
committed by GitHub
parent 90eef10d5c
commit b332c64e38
4 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
impl_name: create_runtime_str!("substrate-node"),
authoring_version: 10,
spec_version: 30,
impl_version: 33,
impl_version: 34,
apis: RUNTIME_API_VERSIONS,
};
@@ -181,12 +181,14 @@ fn decl_store_extra_genesis(
let mut opt_build;
// need build line
if let (Some(ref getter), Some(ref config)) = (getter, config) {
if let Some(ref config) = config {
let ident = if let Some(ident) = config.expr.content.as_ref() {
quote!( #ident )
} else {
} else if let Some(ref getter) = getter {
let ident = &getter.getfn.content;
quote!( #ident )
} else {
return Err(syn::Error::new_spanned(name, format!("Invalid storage definiton, couldn't find config identifier: storage must either have a get identifier `get(ident)` or a defined config identifier `config(ident)`")));
};
if type_infos.kind.is_simple() && ext::has_parametric_type(type_infos.value_type, traitinstance) {
is_trait_needed = true;