decl_storage as a proc_macro (#1176)

* `decl_storage` parsing of the macro (TODO change tool crate structure)

* Start formatting, for now use inner macro.
Still missing optional formating last part (genesis ...).

* Calling extra genesis macro

* decl_storage lines parsing.

* genesis macro as quote (need some cleaning reorg)

* dirty $crate substitute

* proc crate reorg.

* PR impl : skip usage of phantom data, it only applies in test and
council (others required it).

* Remaining macro of decl_storage, warning stringify behave sometime
oddly.

* Formatting code and some cleaning.

* Include line parsing to main struct (cannot use existing macro anymore).

* Remove genesis phantom data when there is already a field with type
parameter.

* Revert wasm files

* Remove old version of `decl_storage`.

* Fix false positive for phantom trait (additional type check on config
build).

* slight changes:
- return token errors instead of panic
- do not use useless intermediate vec

* Update srml/support/procedural/tools/derive/src/lib.rs

remove indent

Co-Authored-By: cheme <emericchevalier.pro@gmail.com>

* Switch iterations to fold, remove unused import.
This commit is contained in:
cheme
2018-12-09 21:09:39 +01:00
committed by Bastian Köcher
parent 3ffb45e3c8
commit ed5b78eaf0
34 changed files with 1681 additions and 1427 deletions
-5
View File
@@ -88,12 +88,10 @@ pub fn new_test_ext(
t.extend(consensus::GenesisConfig::<Test>{
code: vec![],
authorities: vec![],
_genesis_phantom_data: Default::default(),
}.build_storage().unwrap().0);
t.extend(session::GenesisConfig::<Test>{
session_length,
validators: vec![10, 20],
_genesis_phantom_data: Default::default(),
}.build_storage().unwrap().0);
t.extend(balances::GenesisConfig::<Test>{
balances: if monied {
@@ -111,7 +109,6 @@ pub fn new_test_ext(
transfer_fee: 0,
creation_fee: 0,
reclaim_rebate: 0,
_genesis_phantom_data: Default::default(),
}.build_storage().unwrap().0);
t.extend(GenesisConfig::<Test>{
sessions_per_era,
@@ -125,11 +122,9 @@ pub fn new_test_ext(
current_session_reward: reward,
current_offline_slash: 20,
offline_slash_grace: 0,
_genesis_phantom_data: Default::default(),
}.build_storage().unwrap().0);
t.extend(timestamp::GenesisConfig::<Test>{
period: 5,
_genesis_phantom_data: Default::default(),
}.build_storage().unwrap().0);
runtime_io::TestExternalities::new(t)
}