get span beforehand

This commit is contained in:
Mike Ledger 2020-07-04 07:42:30 +10:00 committed by Austin Bonander
parent 627be88634
commit ee106286a0

View File

@ -53,11 +53,12 @@ impl Parse for QueryMacroInput {
let _ = input.parse::<syn::token::Eq>()?;
if key == "source" {
let span = input.span();
let query_str = Punctuated::<LitStr, Token![+]>::parse_separated_nonempty(input)?
.iter()
.map(LitStr::value)
.collect();
query_src = Some((QuerySrc::String(query_str), input.span()));
query_src = Some((QuerySrc::String(query_str), span));
} else if key == "source_file" {
let lit_str = input.parse::<LitStr>()?;
query_src = Some((QuerySrc::File(lit_str.value()), lit_str.span()));