Refactor construct_runtime to procedural (#3810)

* interim

* interim

* interim

* first working section

* cleanup

* finished parsing

* cleanup

* added system module search

* added clone and find_entry

* generic find_module_entry

* interim

* working event

* added generic event with no instance error

* cleanup

* added decl origin

* cleanup

* added all modules

* added outer dispatch

* added modules expansion

* refactored transformations

* updated error message

* added resolve mechanics

* added metadata

* finished config

* finished inherents

* added validate_unsigned

* added compares

* cleanup

* cleanup

* cleanup

* fix

* updated modules for last one wins

* cleanup

* made nested modules

* updated impl version

* removed comment

* cleanup

* added ui tests

* added optional comma

* removed unnecessary to string cast

* removed no compile

* cleanup

* fmt

* returned nocompile

* Update srml/support/procedural/src/construct_runtime/parse.rs

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

* added where definition

* updated ui tests

* updated ui test cases

* added test case

* updated tests

* interim

* added parse for module part

* removed totokens

* fixes

* fixed multiple iter

* changed TokenStream

* fmt

* updated trybuild

* added test for arguments

* fmt

* fixes + more tests

* fixes

* fmt

* rolled back runtime

* minor fixes

* empty

* fixes

* fmt

* Update paint/support/procedural/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update paint/support/procedural/src/lib.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* Update paint/support/procedural/src/construct_runtime/parse.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* interim

* refactored seen_keys

* refactored hash_set

* Update paint/support/procedural/src/construct_runtime/mod.rs

Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>

* refactored find

* fix

* fixed all_modules

* added double declaration check

* small fix

* fmt

* fix

* fix default

* format
This commit is contained in:
Alexey
2019-11-25 19:48:18 +03:00
committed by Bastian Köcher
parent d56d6163ef
commit d7b9dd300b
43 changed files with 1148 additions and 955 deletions
@@ -59,6 +59,11 @@ macro_rules! groups_impl {
}
}
impl <P: Clone> Clone for $name<P> {
fn clone(&self) -> Self {
Self { token: self.token.clone(), content: self.content.clone() }
}
}
}
}
@@ -72,11 +77,11 @@ pub struct PunctuatedInner<P,T,V> {
pub variant: V,
}
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct NoTrailing;
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Trailing;
pub type Punctuated<P,T> = PunctuatedInner<P,T,NoTrailing>;
@@ -107,6 +112,12 @@ impl<P: ToTokens, T: ToTokens, V> ToTokens for PunctuatedInner<P,T,V> {
}
}
impl <P: Clone, T: Clone, V: Clone> Clone for PunctuatedInner<P, T, V> {
fn clone(&self) -> Self {
Self { inner: self.inner.clone(), variant: self.variant.clone() }
}
}
/// Note that syn Meta is almost fine for use case (lacks only `ToToken`)
#[derive(Debug, Clone)]
pub struct Meta {
@@ -178,6 +189,14 @@ impl<P: ToTokens> ToTokens for Opt<P> {
}
}
impl <P: Clone> Clone for Opt<P> {
fn clone(&self) -> Self {
Self {
inner: self.inner.clone()
}
}
}
pub fn extract_type_option(typ: &syn::Type) -> Option<syn::Type> {
if let syn::Type::Path(ref path) = typ {
let v = path.path.segments.last()?;