Forbid stray tokens in call index (#13036)

* Check for call_index

* fixes

* pallet ui test for weight attribute

* Update frame/support/procedural/src/pallet/parse/call.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fix

* small fix

* wrong return type

* ...

* .

* final fix

* update .stderr

* commit

* udpate

* Update frame/support/procedural/src/pallet/parse/call.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* update .stderr

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Sergej Sakac
2023-01-02 11:23:33 +01:00
committed by GitHub
parent 9c69fc1b32
commit 5af801ce60
5 changed files with 91 additions and 0 deletions
@@ -93,6 +93,10 @@ impl syn::parse::Parse for FunctionAttr {
let call_index_content;
syn::parenthesized!(call_index_content in content);
let index = call_index_content.parse::<syn::LitInt>()?;
if !index.suffix().is_empty() {
let msg = "Number literal must not have a suffix";
return Err(syn::Error::new(index.span(), msg))
}
Ok(FunctionAttr::CallIndex(index.base10_parse()?))
} else {
Err(lookahead.error())