[breaking-change] don't pub export ast::Stmt_ variants
This commit is contained in:
@@ -205,7 +205,7 @@ macro_rules! make_stmts_default {
|
||||
($me:expr) => {
|
||||
$me.make_expr().map(|e| {
|
||||
SmallVector::one(P(codemap::respan(
|
||||
e.span, ast::StmtExpr(e, ast::DUMMY_NODE_ID))))
|
||||
e.span, ast::StmtKind::Expr(e, ast::DUMMY_NODE_ID))))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -402,8 +402,8 @@ impl MacResult for DummyResult {
|
||||
fn make_stmts(self: Box<DummyResult>) -> Option<SmallVector<P<ast::Stmt>>> {
|
||||
Some(SmallVector::one(P(
|
||||
codemap::respan(self.span,
|
||||
ast::StmtExpr(DummyResult::raw_expr(self.span),
|
||||
ast::DUMMY_NODE_ID)))))
|
||||
ast::StmtKind::Expr(DummyResult::raw_expr(self.span),
|
||||
ast::DUMMY_NODE_ID)))))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
}
|
||||
|
||||
fn stmt_expr(&self, expr: P<ast::Expr>) -> P<ast::Stmt> {
|
||||
P(respan(expr.span, ast::StmtSemi(expr, ast::DUMMY_NODE_ID)))
|
||||
P(respan(expr.span, ast::StmtKind::Semi(expr, ast::DUMMY_NODE_ID)))
|
||||
}
|
||||
|
||||
fn stmt_let(&self, sp: Span, mutbl: bool, ident: ast::Ident,
|
||||
@@ -525,7 +525,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
attrs: None,
|
||||
});
|
||||
let decl = respan(sp, ast::DeclKind::Local(local));
|
||||
P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
|
||||
P(respan(sp, ast::StmtKind::Decl(P(decl), ast::DUMMY_NODE_ID)))
|
||||
}
|
||||
|
||||
fn stmt_let_typed(&self,
|
||||
@@ -549,7 +549,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
attrs: None,
|
||||
});
|
||||
let decl = respan(sp, ast::DeclKind::Local(local));
|
||||
P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
|
||||
P(respan(sp, ast::StmtKind::Decl(P(decl), ast::DUMMY_NODE_ID)))
|
||||
}
|
||||
|
||||
fn block(&self, span: Span, stmts: Vec<P<ast::Stmt>>,
|
||||
@@ -559,7 +559,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
|
||||
fn stmt_item(&self, sp: Span, item: P<ast::Item>) -> P<ast::Stmt> {
|
||||
let decl = respan(sp, ast::DeclKind::Item(item));
|
||||
P(respan(sp, ast::StmtDecl(P(decl), ast::DUMMY_NODE_ID)))
|
||||
P(respan(sp, ast::StmtKind::Decl(P(decl), ast::DUMMY_NODE_ID)))
|
||||
}
|
||||
|
||||
fn block_expr(&self, expr: P<ast::Expr>) -> P<ast::Block> {
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
|
||||
use ast::{Block, Crate, DeclKind, PatMac};
|
||||
use ast::{Local, Ident, Mac_, Name};
|
||||
use ast::{ItemMac, MacStmtWithSemicolon, Mrk, Stmt, StmtDecl, StmtMac};
|
||||
use ast::{StmtExpr, StmtSemi};
|
||||
use ast::{ItemMac, MacStmtWithSemicolon, Mrk, Stmt, StmtKind};
|
||||
use ast::TokenTree;
|
||||
use ast;
|
||||
use ext::mtwt;
|
||||
@@ -507,7 +506,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
|
||||
fn expand_stmt(stmt: P<Stmt>, fld: &mut MacroExpander) -> SmallVector<P<Stmt>> {
|
||||
let stmt = stmt.and_then(|stmt| stmt);
|
||||
let (mac, style, attrs) = match stmt.node {
|
||||
StmtMac(mac, style, attrs) => (mac, style, attrs),
|
||||
StmtKind::Mac(mac, style, attrs) => (mac, style, attrs),
|
||||
_ => return expand_non_macro_stmt(stmt, fld)
|
||||
};
|
||||
|
||||
@@ -539,7 +538,7 @@ fn expand_stmt(stmt: P<Stmt>, fld: &mut MacroExpander) -> SmallVector<P<Stmt>> {
|
||||
let new_stmt = stmt.map(|Spanned {node, span}| {
|
||||
Spanned {
|
||||
node: match node {
|
||||
StmtExpr(e, stmt_id) => StmtSemi(e, stmt_id),
|
||||
StmtKind::Expr(e, stmt_id) => StmtKind::Semi(e, stmt_id),
|
||||
_ => node /* might already have a semi */
|
||||
},
|
||||
span: span
|
||||
@@ -558,7 +557,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
|
||||
-> SmallVector<P<Stmt>> {
|
||||
// is it a let?
|
||||
match node {
|
||||
StmtDecl(decl, node_id) => decl.and_then(|Spanned {node: decl, span}| match decl {
|
||||
StmtKind::Decl(decl, node_id) => decl.and_then(|Spanned {node: decl, span}| match decl {
|
||||
DeclKind::Local(local) => {
|
||||
// take it apart:
|
||||
let rewritten_local = local.map(|Local {id, pat, ty, init, span, attrs}| {
|
||||
@@ -596,7 +595,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
|
||||
}
|
||||
});
|
||||
SmallVector::one(P(Spanned {
|
||||
node: StmtDecl(P(Spanned {
|
||||
node: StmtKind::Decl(P(Spanned {
|
||||
node: DeclKind::Local(rewritten_local),
|
||||
span: span
|
||||
}),
|
||||
@@ -606,7 +605,7 @@ fn expand_non_macro_stmt(Spanned {node, span: stmt_span}: Stmt, fld: &mut MacroE
|
||||
}
|
||||
_ => {
|
||||
noop_fold_stmt(Spanned {
|
||||
node: StmtDecl(P(Spanned {
|
||||
node: StmtKind::Decl(P(Spanned {
|
||||
node: decl,
|
||||
span: span
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user