diff options
| author | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-08 17:06:20 +0100 |
|---|---|---|
| committer | Oliver Schneider <git-spam-no-reply9815368754983@oli-obk.de> | 2016-02-11 12:34:48 +0100 |
| commit | 69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33 (patch) | |
| tree | 8c9a87b64cd8054e093c1c07f6c0b987cd00f9c3 /src/libsyntax/ext | |
| parent | 05d4cefd630cd9ae104555e69ceb3b1566298a6a (diff) | |
| download | rust-69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33.tar.gz rust-69072c4f5d18d7a1762fbfb007b0ba3d6b59ad33.zip | |
[breaking-change] don't pub export ast::Lit_ variants
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 23 | ||||
| -rw-r--r-- | src/libsyntax/ext/quote.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 2 |
4 files changed, 20 insertions, 19 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index b58f8007e0a..267b2dd9f6a 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -349,7 +349,7 @@ impl DummyResult { pub fn raw_expr(sp: Span) -> P<ast::Expr> { P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: ast::ExprKind::Lit(P(codemap::respan(sp, ast::LitBool(false)))), + node: ast::ExprKind::Lit(P(codemap::respan(sp, ast::LitKind::Bool(false)))), span: sp, attrs: None, }) @@ -774,7 +774,7 @@ pub fn expr_to_string(cx: &mut ExtCtxt, expr: P<ast::Expr>, err_msg: &str) let expr = cx.expander().fold_expr(expr); match expr.node { ast::ExprKind::Lit(ref l) => match l.node { - ast::LitStr(ref s, style) => return Some(((*s).clone(), style)), + ast::LitKind::Str(ref s, style) => return Some(((*s).clone(), style)), _ => cx.span_err(l.span, err_msg) }, _ => cx.span_err(expr.span, err_msg) diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 241ea976eee..9302cabe8d8 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -139,7 +139,7 @@ pub trait AstBuilder { fn expr_struct_ident(&self, span: Span, id: ast::Ident, fields: Vec<ast::Field>) -> P<ast::Expr>; - fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr>; + fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P<ast::Expr>; fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr>; fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr>; @@ -285,7 +285,7 @@ pub trait AstBuilder { fn meta_name_value(&self, sp: Span, name: InternedString, - value: ast::Lit_) + value: ast::LitKind) -> P<ast::MetaItem>; fn item_use(&self, sp: Span, @@ -676,29 +676,30 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.expr_struct(span, self.path_ident(span, id), fields) } - fn expr_lit(&self, sp: Span, lit: ast::Lit_) -> P<ast::Expr> { + fn expr_lit(&self, sp: Span, lit: ast::LitKind) -> P<ast::Expr> { self.expr(sp, ast::ExprKind::Lit(P(respan(sp, lit)))) } fn expr_usize(&self, span: Span, i: usize) -> P<ast::Expr> { - self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::UintTy::Us))) + self.expr_lit(span, ast::LitKind::Int(i as u64, ast::UnsignedIntLit(ast::UintTy::Us))) } fn expr_isize(&self, sp: Span, i: isize) -> P<ast::Expr> { if i < 0 { let i = (-i) as u64; - let lit = self.expr_lit(sp, ast::LitInt(i, ast::SignedIntLit(ast::IntTy::Is))); + let lit_ty = ast::LitIntType::Signed(ast::IntTy::Is); + let lit = self.expr_lit(sp, ast::LitKind::Int(i, lit_ty)); self.expr_unary(sp, ast::UnOp::Neg, lit) } else { - self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::IntTy::Is))) + self.expr_lit(sp, ast::LitKind::Int(i as u64, ast::SignedIntLit(ast::IntTy::Is))) } } fn expr_u32(&self, sp: Span, u: u32) -> P<ast::Expr> { - self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::UintTy::U32))) + self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U32))) } fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> { - self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::UintTy::U8))) + self.expr_lit(sp, ast::LitKind::Int(u as u64, ast::UnsignedIntLit(ast::UintTy::U8))) } fn expr_bool(&self, sp: Span, value: bool) -> P<ast::Expr> { - self.expr_lit(sp, ast::LitBool(value)) + self.expr_lit(sp, ast::LitKind::Bool(value)) } fn expr_vec(&self, sp: Span, exprs: Vec<P<ast::Expr>>) -> P<ast::Expr> { @@ -712,7 +713,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.expr_addr_of(sp, self.expr_vec(sp, exprs)) } fn expr_str(&self, sp: Span, s: InternedString) -> P<ast::Expr> { - self.expr_lit(sp, ast::LitStr(s, ast::CookedStr)) + self.expr_lit(sp, ast::LitKind::Str(s, ast::CookedStr)) } fn expr_cast(&self, sp: Span, expr: P<ast::Expr>, ty: P<ast::Ty>) -> P<ast::Expr> { @@ -1113,7 +1114,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn meta_name_value(&self, sp: Span, name: InternedString, - value: ast::Lit_) + value: ast::LitKind) -> P<ast::MetaItem> { P(respan(sp, ast::MetaNameValue(name, respan(sp, value)))) } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index dfe3f8e3c54..18342fa775b 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -218,7 +218,7 @@ pub mod rt { impl ToTokens for str { fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> { - let lit = ast::LitStr( + let lit = ast::LitKind::Str( token::intern_and_get_ident(self), ast::CookedStr); dummy_spanned(lit).to_tokens(cx) } @@ -249,13 +249,13 @@ pub mod rt { impl ToTokens for bool { fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> { - dummy_spanned(ast::LitBool(*self)).to_tokens(cx) + dummy_spanned(ast::LitKind::Bool(*self)).to_tokens(cx) } } impl ToTokens for char { fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> { - dummy_spanned(ast::LitChar(*self)).to_tokens(cx) + dummy_spanned(ast::LitKind::Char(*self)).to_tokens(cx) } } @@ -268,7 +268,7 @@ pub mod rt { } else { *self }; - let lit = ast::LitInt(val as u64, ast::SignedIntLit($tag)); + let lit = ast::LitKind::Int(val as u64, ast::SignedIntLit($tag)); let lit = P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::Lit(P(dummy_spanned(lit))), @@ -290,7 +290,7 @@ pub mod rt { (unsigned, $t:ty, $tag:expr) => ( impl ToTokens for $t { fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> { - let lit = ast::LitInt(*self as u64, ast::UnsignedIntLit($tag)); + let lit = ast::LitKind::Int(*self as u64, ast::UnsignedIntLit($tag)); dummy_spanned(lit).to_tokens(cx) } } diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index f00224bacdd..3e375e1798d 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -187,7 +187,7 @@ pub fn expand_include_bytes(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) let filename = format!("{}", file.display()); cx.codemap().new_filemap_and_lines(&filename, ""); - base::MacEager::expr(cx.expr_lit(sp, ast::LitByteStr(Rc::new(bytes)))) + base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Rc::new(bytes)))) } } } |
