fix construct runtime module position bug (#1849)

* fix construct runtime module position

* Update srml/support/src/runtime.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update srml/support/src/runtime.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update srml/support/src/runtime.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update srml/support/src/runtime.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>

* Update srml/support/src/runtime.rs

Co-Authored-By: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
thiolliere
2019-02-25 11:41:40 +01:00
committed by Bastian Köcher
parent 43e4544884
commit dab5ad913f
4 changed files with 38 additions and 38 deletions
+37 -37
View File
@@ -339,7 +339,7 @@ macro_rules! construct_runtime {
$runtime;
;
$(
$name: $module::{ $( $modules $( <$modules_generic> )* )* }
$name: $module::{ $( $modules )* }
)*
);
$crate::__decl_outer_log!(
@@ -718,38 +718,62 @@ macro_rules! __decl_outer_dispatch {
#[macro_export]
#[doc(hidden)]
macro_rules! __decl_runtime_metadata {
// contain a module
// leading is Module : parse
(
$runtime:ident;
$( $parsed_modules:ident { $( $withs:ident )* } )*;
$( { leading_module: $( $leading_module:ident )* } )?
$name:ident: $module:ident::{
Module $( $modules:ident $( <$modules_generic:ident> )* )*
Module $( $modules:ident )*
}
$( $rest_name:ident : $rest_module:ident::{
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* )*
$( $rest_modules:ident )*
})*
) => {
$crate::__decl_runtime_metadata!(@Module
$crate::__decl_runtime_metadata!(
$runtime;
$( $parsed_modules { $( $withs )* } )*;
$name: $module::{ $( $modules $( <$modules_generic> )* )* }
$( $parsed_modules { $( $withs )* } )* $module { $( $( $leading_module )* )? $( $modules )* };
$(
$rest_name: $rest_module::{
$( $rest_modules $( <$rest_modules_generic> )* )*
$( $rest_modules )*
}
)*
);
};
// do not contain Module : skip
// leading isn't Module : put it in leadings
(
$runtime:ident;
$( $parsed_modules:ident { $( $withs:ident )* } )*;
$( { leading_module: $( $leading_module:ident )* } )?
$name:ident: $module:ident::{
$( $modules:ident $( <$modules_generic:ident> )* )*
$other_module:ident $( $modules:ident )*
}
$( $rest_name:ident : $rest_module:ident::{
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* )*
$( $rest_modules:ident )*
})*
) => {
$crate::__decl_runtime_metadata!(
$runtime;
$( $parsed_modules { $( $withs )* } )*;
{ leading_module: $( $( $leading_module )* )? $other_module }
$name: $module::{
$( $modules )*
}
$(
$rest_name: $rest_module::{
$( $rest_modules )*
}
)*
);
};
// does not contain Module : skip
(
$runtime:ident;
$( $parsed_modules:ident { $( $withs:ident )* } )*;
$( { leading_module: $( $leading_module:ident )* } )?
$name:ident: $module:ident::{}
$( $rest_name:ident : $rest_module:ident::{
$( $rest_modules:ident )*
})*
) => {
$crate::__decl_runtime_metadata!(
@@ -757,31 +781,7 @@ macro_rules! __decl_runtime_metadata {
$( $parsed_modules { $( $withs )* } )*;
$(
$rest_name: $rest_module::{
$( $rest_modules $( <$rest_modules_generic> )* )*
}
)*
);
};
// process module
(@Module
$runtime:ident;
$( $parsed_modules:ident { $( $withs:ident )* } )*;
$name:ident: $module:ident::{
$( $modules:ident $( <$modules_generic:ident> )* )*
}
$($rest_name:ident : $rest_module:ident::{
$( $rest_modules:ident $( <$rest_modules_generic:ident> )* )*
})*
) => {
$crate::__decl_runtime_metadata!(
$runtime;
$( $parsed_modules { $( $withs )* } )*
$module {
$($modules)*
};
$(
$rest_name: $rest_module::{
$( $rest_modules $( <$rest_modules_generic> )* )*
$( $rest_modules )*
}
)*
);