Clean up statement parsing without changing the semantics of parse_stmt.

This commit is contained in:
Jeffrey Seyfried
2016-07-02 09:01:21 +00:00
parent 3265bd54b5
commit 6189e6cdba
3 changed files with 59 additions and 112 deletions

View File

@@ -444,14 +444,7 @@ fn expand_stmt(stmt: Stmt, fld: &mut MacroExpander) -> SmallVector<Stmt> {
// semicolon to the final statement produced by expansion.
if style == MacStmtStyle::Semicolon {
if let Some(stmt) = fully_expanded.pop() {
fully_expanded.push(Stmt {
id: stmt.id,
node: match stmt.node {
StmtKind::Expr(expr) => StmtKind::Semi(expr),
_ => stmt.node /* might already have a semi */
},
span: stmt.span,
});
fully_expanded.push(stmt.add_trailing_semicolon());
}
}