add temporarily unused ctxt field to mac_invoc_tt

This commit is contained in:
John Clements 2013-07-03 15:16:04 -07:00
parent 3621c674cc
commit 09e6dda4f2
5 changed files with 14 additions and 13 deletions

View File

@ -659,7 +659,7 @@ pub enum matcher_ {
// There's only one flavor, now, so this could presumably be simplified.
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
pub enum mac_ {
mac_invoc_tt(Path,~[token_tree]), // new macro-invocation
mac_invoc_tt(Path,~[token_tree],SyntaxContext), // new macro-invocation
}
pub type lit = Spanned<lit_>;

View File

@ -43,7 +43,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
ExprMac(ref mac) => {
match (*mac).node {
// Token-tree macros:
mac_invoc_tt(ref pth, ref tts) => {
mac_invoc_tt(ref pth, ref tts, ctxt) => {
if (pth.segments.len() > 1u) {
cx.span_fatal(
pth.span,
@ -368,7 +368,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
fld: @ast_fold)
-> Option<@ast::item> {
let (pth, tts) = match it.node {
item_mac(codemap::Spanned { node: mac_invoc_tt(ref pth, ref tts), _}) => {
item_mac(codemap::Spanned { node: mac_invoc_tt(ref pth, ref tts, ctxt), _}) => {
(pth, (*tts).clone())
}
_ => cx.span_bug(it.span, "invalid item macro invocation")
@ -471,7 +471,7 @@ pub fn expand_stmt(extsbox: @mut SyntaxEnv,
let (mac, pth, tts, semi) = match *s {
StmtMac(ref mac, semi) => {
match mac.node {
mac_invoc_tt(ref pth, ref tts) => {
mac_invoc_tt(ref pth, ref tts, ctxt) => {
((*mac).clone(), pth, (*tts).clone(), semi)
}
}

View File

@ -116,9 +116,10 @@ fn fold_arg_(a: arg, fld: @ast_fold) -> arg {
fn fold_mac_(m: &mac, fld: @ast_fold) -> mac {
Spanned {
node: match m.node {
mac_invoc_tt(ref p,ref tts) =>
mac_invoc_tt(ref p,ref tts,ctxt) =>
mac_invoc_tt(fld.fold_path(p),
fold_tts(*tts,|id|{fld.fold_ident(id)}))
fold_tts(*tts,|id|{fld.fold_ident(id)}),
ctxt)
},
span: fld.new_span(m.span)
}

View File

@ -21,7 +21,7 @@
use ast::{BiBitAnd, BiBitOr, BiBitXor, Block};
use ast::{BlockCheckMode, UnBox};
use ast::{Crate, CrateConfig, Decl, DeclItem};
use ast::{DeclLocal, DefaultBlock, UnDeref, BiDiv, enum_def, explicit_self};
use ast::{DeclLocal, DefaultBlock, UnDeref, BiDiv, EMPTY_CTXT, enum_def, explicit_self};
use ast::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock};
use ast::{ExprBreak, ExprCall, ExprCast, ExprDoBody};
@ -1875,7 +1875,7 @@ pub fn parse_bottom_expr(&self) -> @Expr {
|p| p.parse_token_tree());
let hi = self.span.hi;
return self.mk_mac_expr(lo, hi, mac_invoc_tt(pth, tts));
return self.mk_mac_expr(lo, hi, mac_invoc_tt(pth, tts, EMPTY_CTXT));
} else if *self.token == token::LBRACE {
// This might be a struct literal.
if self.looking_at_record_literal() {
@ -3197,14 +3197,14 @@ fn check_expected_item(p: &Parser, found_attrs: bool) {
if id == token::special_idents::invalid {
return @spanned(lo, hi, StmtMac(
spanned(lo, hi, mac_invoc_tt(pth, tts)), false));
spanned(lo, hi, mac_invoc_tt(pth, tts, EMPTY_CTXT)), false));
} else {
// if it has a special ident, it's definitely an item
return @spanned(lo, hi, StmtDecl(
@spanned(lo, hi, DeclItem(
self.mk_item(
lo, hi, id /*id is good here*/,
item_mac(spanned(lo, hi, mac_invoc_tt(pth, tts))),
item_mac(spanned(lo, hi, mac_invoc_tt(pth, tts, EMPTY_CTXT))),
inherited, ~[/*no attrs*/]))),
self.get_id()));
}
@ -4809,7 +4809,7 @@ fn parse_macro_use_or_failure(
_ => self.fatal("expected open delimiter")
};
// single-variant-enum... :
let m = ast::mac_invoc_tt(pth, tts);
let m = ast::mac_invoc_tt(pth, tts, EMPTY_CTXT);
let m: ast::mac = codemap::Spanned { node: m,
span: mk_sp(self.span.lo,
self.span.hi) };

View File

@ -619,7 +619,7 @@ pub fn print_item(s: @ps, item: &ast::item) {
}
bclose(s, item.span);
}
ast::item_mac(codemap::Spanned { node: ast::mac_invoc_tt(ref pth, ref tts),
ast::item_mac(codemap::Spanned { node: ast::mac_invoc_tt(ref pth, ref tts, ctxt),
_}) => {
print_visibility(s, item.vis);
print_path(s, pth, false);
@ -1021,7 +1021,7 @@ fn do_else(s: @ps, els: Option<@ast::Expr>) {
pub fn print_mac(s: @ps, m: &ast::mac) {
match m.node {
ast::mac_invoc_tt(ref pth, ref tts) => {
ast::mac_invoc_tt(ref pth, ref tts, ctxt) => {
print_path(s, pth, false);
word(s.s, "!");
popen(s);