Refactor TokenStream to hold Vec<TokenTree> instead of tt::Subtree
`TokenStream` assumes that its subtree's delimeter is `None`, and this should be encoded in the type system instead of having a delimiter field that is mostly ignored. `tt::Subtree` is just `pub delimiter: Option<Delimiter>, pub token_trees: Vec<TokenTree>`, so a Subtree that is statically guaranteed not to have a delimiter is just Vec<TokenTree>.
This commit is contained in:
@@ -138,7 +138,7 @@ impl Expander {
|
||||
parsed_body,
|
||||
false,
|
||||
);
|
||||
return res.map(|it| it.subtree);
|
||||
return res.map(|it| it.into_subtree());
|
||||
}
|
||||
bridge::client::ProcMacro::Bang { name, client } if *name == macro_name => {
|
||||
let res = client.run(
|
||||
@@ -147,7 +147,7 @@ impl Expander {
|
||||
parsed_body,
|
||||
false,
|
||||
);
|
||||
return res.map(|it| it.subtree);
|
||||
return res.map(|it| it.into_subtree());
|
||||
}
|
||||
bridge::client::ProcMacro::Attr { name, client } if *name == macro_name => {
|
||||
let res = client.run(
|
||||
@@ -157,7 +157,7 @@ impl Expander {
|
||||
parsed_body,
|
||||
false,
|
||||
);
|
||||
return res.map(|it| it.subtree);
|
||||
return res.map(|it| it.into_subtree());
|
||||
}
|
||||
_ => continue,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user