-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Refactor construct_runtime
to procedural
#3810
Refactor construct_runtime
to procedural
#3810
Conversation
…truct-runtime-proc-macro # Conflicts: # srml/support/src/runtime.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again for all your work. I reviewed it, mostly it looks good, but I think that we still can improve and reduce the amount of code :)
let transformed_generics: Vec<_> = generics[0] | ||
.params | ||
.iter() | ||
.map(|param| quote!(<#param>)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be just a map()
on the value from above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean here. The thing is that in case of 2 params decl macros accept something like <T> <I>
instead of <T, I>
- that's what this code does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we accept <T><I>
?
And what I wanted is, you should not call collect
in line 188. Use find
and then you just get an Option
that you can map directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we accept
<T><I>
?
substrate/primitives/sr-primitives/src/lib.rs
Lines 523 to 529 in ba72d75
macro_rules! impl_outer_config { | |
( | |
pub struct $main:ident for $concrete:ident { | |
$( $config:ident => | |
$snake:ident $( $instance:ident )? $( <$generic:ident> )*, )* | |
} | |
) => { |
As far as I can see it accepts <T>, <I>
vs <T, I>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And what I wanted is, you should not call collect in line 188
I see, I made the fix to make the code shorter
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
@@ -243,7 +243,7 @@ construct_runtime!( | |||
Timestamp: timestamp::{Module, Call, Storage, Inherent}, | |||
Aura: aura::{Module, Config<T>, Inherent(Timestamp)}, | |||
Grandpa: grandpa::{Module, Call, Storage, Config, Event}, | |||
Indices: indices::{default, Config<T>}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bkchr Note that I had to fix it, since now construct_runtime
errors on this
@alleycat-at-git ready for review again? |
@bkchr Yes |
conflicts need resolving @alleycat-at-git and need to do a final review @bkchr @thiolliere . |
…truct-runtime-proc-macro
…truct-runtime-proc-macro # Conflicts: # bin/node/runtime/src/lib.rs # frame/support/src/lib.rs # frame/support/src/runtime.rs
@gavofyork @bkchr @thiolliere - fixed conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing that needs to be done before merging, please convert your files to use tabs and not spaces.
@bkchr fixed |
Description
Refactor
construct_runtime
macro from declarative to procedural. Reference issue #1897.