1
Fork 0

Factor out StmtKind::MacCall fields into MacCallStmt struct

In PR #76130, I add a fourth field, which makes using a tuple variant
somewhat unwieldy.
This commit is contained in:
Aaron Hill 2020-08-30 18:38:32 -04:00
parent 85fbf49ce0
commit 090b16717a
No known key found for this signature in database
GPG key ID: B4087E510E98B164
8 changed files with 32 additions and 23 deletions

View file

@ -922,9 +922,13 @@ impl Stmt {
pub fn add_trailing_semicolon(mut self) -> Self {
self.kind = match self.kind {
StmtKind::Expr(expr) => StmtKind::Semi(expr),
StmtKind::MacCall(mac) => StmtKind::MacCall(
mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)),
),
StmtKind::MacCall(mac) => {
StmtKind::MacCall(mac.map(|MacCallStmt { mac, style: _, attrs }| MacCallStmt {
mac,
style: MacStmtStyle::Semicolon,
attrs,
}))
}
kind => kind,
};
self
@ -958,7 +962,14 @@ pub enum StmtKind {
/// Just a trailing semi-colon.
Empty,
/// Macro.
MacCall(P<(MacCall, MacStmtStyle, AttrVec)>),
MacCall(P<MacCallStmt>),
}
#[derive(Clone, Encodable, Decodable, Debug)]
pub struct MacCallStmt {
pub mac: MacCall,
pub style: MacStmtStyle,
pub attrs: AttrVec,
}
#[derive(Clone, Copy, PartialEq, Encodable, Decodable, Debug)]