add temporarily unused ctxt field to mac_invoc_tt
This commit is contained in:
parent
3621c674cc
commit
09e6dda4f2
5 changed files with 14 additions and 13 deletions
|
@ -659,7 +659,7 @@ pub type mac = Spanned<mac_>;
|
||||||
// There's only one flavor, now, so this could presumably be simplified.
|
// There's only one flavor, now, so this could presumably be simplified.
|
||||||
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
#[deriving(Clone, Eq, Encodable, Decodable, IterBytes)]
|
||||||
pub enum mac_ {
|
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_>;
|
pub type lit = Spanned<lit_>;
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv,
|
||||||
ExprMac(ref mac) => {
|
ExprMac(ref mac) => {
|
||||||
match (*mac).node {
|
match (*mac).node {
|
||||||
// Token-tree macros:
|
// Token-tree macros:
|
||||||
mac_invoc_tt(ref pth, ref tts) => {
|
mac_invoc_tt(ref pth, ref tts, ctxt) => {
|
||||||
if (pth.segments.len() > 1u) {
|
if (pth.segments.len() > 1u) {
|
||||||
cx.span_fatal(
|
cx.span_fatal(
|
||||||
pth.span,
|
pth.span,
|
||||||
|
@ -368,7 +368,7 @@ pub fn expand_item_mac(extsbox: @mut SyntaxEnv,
|
||||||
fld: @ast_fold)
|
fld: @ast_fold)
|
||||||
-> Option<@ast::item> {
|
-> Option<@ast::item> {
|
||||||
let (pth, tts) = match it.node {
|
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())
|
(pth, (*tts).clone())
|
||||||
}
|
}
|
||||||
_ => cx.span_bug(it.span, "invalid item macro invocation")
|
_ => 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 {
|
let (mac, pth, tts, semi) = match *s {
|
||||||
StmtMac(ref mac, semi) => {
|
StmtMac(ref mac, semi) => {
|
||||||
match mac.node {
|
match mac.node {
|
||||||
mac_invoc_tt(ref pth, ref tts) => {
|
mac_invoc_tt(ref pth, ref tts, ctxt) => {
|
||||||
((*mac).clone(), pth, (*tts).clone(), semi)
|
((*mac).clone(), pth, (*tts).clone(), semi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,9 +116,10 @@ fn fold_arg_(a: arg, fld: @ast_fold) -> arg {
|
||||||
fn fold_mac_(m: &mac, fld: @ast_fold) -> mac {
|
fn fold_mac_(m: &mac, fld: @ast_fold) -> mac {
|
||||||
Spanned {
|
Spanned {
|
||||||
node: match m.node {
|
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),
|
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)
|
span: fld.new_span(m.span)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ use ast::{_mod, BiAdd, arg, Arm, Attribute, BindByRef, BindInfer};
|
||||||
use ast::{BiBitAnd, BiBitOr, BiBitXor, Block};
|
use ast::{BiBitAnd, BiBitOr, BiBitXor, Block};
|
||||||
use ast::{BlockCheckMode, UnBox};
|
use ast::{BlockCheckMode, UnBox};
|
||||||
use ast::{Crate, CrateConfig, Decl, DeclItem};
|
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::{Expr, Expr_, ExprAddrOf, ExprMatch, ExprAgain};
|
||||||
use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock};
|
use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock};
|
||||||
use ast::{ExprBreak, ExprCall, ExprCast, ExprDoBody};
|
use ast::{ExprBreak, ExprCall, ExprCast, ExprDoBody};
|
||||||
|
@ -1875,7 +1875,7 @@ impl Parser {
|
||||||
|p| p.parse_token_tree());
|
|p| p.parse_token_tree());
|
||||||
let hi = self.span.hi;
|
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 {
|
} else if *self.token == token::LBRACE {
|
||||||
// This might be a struct literal.
|
// This might be a struct literal.
|
||||||
if self.looking_at_record_literal() {
|
if self.looking_at_record_literal() {
|
||||||
|
@ -3197,14 +3197,14 @@ impl Parser {
|
||||||
|
|
||||||
if id == token::special_idents::invalid {
|
if id == token::special_idents::invalid {
|
||||||
return @spanned(lo, hi, StmtMac(
|
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 {
|
} else {
|
||||||
// if it has a special ident, it's definitely an item
|
// if it has a special ident, it's definitely an item
|
||||||
return @spanned(lo, hi, StmtDecl(
|
return @spanned(lo, hi, StmtDecl(
|
||||||
@spanned(lo, hi, DeclItem(
|
@spanned(lo, hi, DeclItem(
|
||||||
self.mk_item(
|
self.mk_item(
|
||||||
lo, hi, id /*id is good here*/,
|
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*/]))),
|
inherited, ~[/*no attrs*/]))),
|
||||||
self.get_id()));
|
self.get_id()));
|
||||||
}
|
}
|
||||||
|
@ -4809,7 +4809,7 @@ impl Parser {
|
||||||
_ => self.fatal("expected open delimiter")
|
_ => self.fatal("expected open delimiter")
|
||||||
};
|
};
|
||||||
// single-variant-enum... :
|
// 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,
|
let m: ast::mac = codemap::Spanned { node: m,
|
||||||
span: mk_sp(self.span.lo,
|
span: mk_sp(self.span.lo,
|
||||||
self.span.hi) };
|
self.span.hi) };
|
||||||
|
|
|
@ -619,7 +619,7 @@ pub fn print_item(s: @ps, item: &ast::item) {
|
||||||
}
|
}
|
||||||
bclose(s, item.span);
|
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_visibility(s, item.vis);
|
||||||
print_path(s, pth, false);
|
print_path(s, pth, false);
|
||||||
|
@ -1021,7 +1021,7 @@ pub fn print_if(s: @ps, test: &ast::Expr, blk: &ast::Block,
|
||||||
|
|
||||||
pub fn print_mac(s: @ps, m: &ast::mac) {
|
pub fn print_mac(s: @ps, m: &ast::mac) {
|
||||||
match m.node {
|
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);
|
print_path(s, pth, false);
|
||||||
word(s.s, "!");
|
word(s.s, "!");
|
||||||
popen(s);
|
popen(s);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue