Refactor away field ctxt of ast::Mac_
This commit is contained in:
@@ -1278,7 +1278,6 @@ pub type Mac = Spanned<Mac_>;
|
|||||||
pub struct Mac_ {
|
pub struct Mac_ {
|
||||||
pub path: Path,
|
pub path: Path,
|
||||||
pub tts: Vec<TokenTree>,
|
pub tts: Vec<TokenTree>,
|
||||||
pub ctxt: SyntaxContext,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
||||||
|
|||||||
@@ -1191,7 +1191,6 @@ impl Folder for Marker {
|
|||||||
node: Mac_ {
|
node: Mac_ {
|
||||||
path: self.fold_path(node.path),
|
path: self.fold_path(node.path),
|
||||||
tts: self.fold_tts(&node.tts),
|
tts: self.fold_tts(&node.tts),
|
||||||
ctxt: mtwt::apply_mark(self.mark, node.ctxt),
|
|
||||||
},
|
},
|
||||||
span: self.new_span(span),
|
span: self.new_span(span),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -520,7 +520,6 @@ pub fn noop_fold_mac<T: Folder>(Spanned {node, span}: Mac, fld: &mut T) -> Mac {
|
|||||||
node: Mac_ {
|
node: Mac_ {
|
||||||
path: fld.fold_path(node.path),
|
path: fld.fold_path(node.path),
|
||||||
tts: fld.fold_tts(&node.tts),
|
tts: fld.fold_tts(&node.tts),
|
||||||
ctxt: node.ctxt,
|
|
||||||
},
|
},
|
||||||
span: fld.new_span(span)
|
span: fld.new_span(span)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use ast::Block;
|
|||||||
use ast::{BlockCheckMode, CaptureBy};
|
use ast::{BlockCheckMode, CaptureBy};
|
||||||
use ast::{Constness, Crate, CrateConfig};
|
use ast::{Constness, Crate, CrateConfig};
|
||||||
use ast::{Decl, DeclKind, Defaultness};
|
use ast::{Decl, DeclKind, Defaultness};
|
||||||
use ast::{EMPTY_CTXT, EnumDef};
|
use ast::EnumDef;
|
||||||
use ast::{Expr, ExprKind, RangeLimits};
|
use ast::{Expr, ExprKind, RangeLimits};
|
||||||
use ast::{Field, FnDecl};
|
use ast::{Field, FnDecl};
|
||||||
use ast::{ForeignItem, ForeignItemKind, FunctionRetTy};
|
use ast::{ForeignItem, ForeignItemKind, FunctionRetTy};
|
||||||
@@ -1467,7 +1467,7 @@ impl<'a> Parser<'a> {
|
|||||||
SeqSep::none(),
|
SeqSep::none(),
|
||||||
|p| p.parse_token_tree())?;
|
|p| p.parse_token_tree())?;
|
||||||
let hi = self.span.hi;
|
let hi = self.span.hi;
|
||||||
TyKind::Mac(spanned(lo, hi, Mac_ { path: path, tts: tts, ctxt: EMPTY_CTXT }))
|
TyKind::Mac(spanned(lo, hi, Mac_ { path: path, tts: tts }))
|
||||||
} else {
|
} else {
|
||||||
// NAMED TYPE
|
// NAMED TYPE
|
||||||
TyKind::Path(None, path)
|
TyKind::Path(None, path)
|
||||||
@@ -2348,7 +2348,7 @@ impl<'a> Parser<'a> {
|
|||||||
|
|
||||||
return Ok(self.mk_mac_expr(lo,
|
return Ok(self.mk_mac_expr(lo,
|
||||||
hi,
|
hi,
|
||||||
Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT },
|
Mac_ { path: pth, tts: tts },
|
||||||
attrs));
|
attrs));
|
||||||
}
|
}
|
||||||
if self.check(&token::OpenDelim(token::Brace)) {
|
if self.check(&token::OpenDelim(token::Brace)) {
|
||||||
@@ -3661,7 +3661,7 @@ impl<'a> Parser<'a> {
|
|||||||
let tts = self.parse_seq_to_end(
|
let tts = self.parse_seq_to_end(
|
||||||
&token::CloseDelim(delim),
|
&token::CloseDelim(delim),
|
||||||
SeqSep::none(), |p| p.parse_token_tree())?;
|
SeqSep::none(), |p| p.parse_token_tree())?;
|
||||||
let mac = Mac_ { path: path, tts: tts, ctxt: EMPTY_CTXT };
|
let mac = Mac_ { path: path, tts: tts };
|
||||||
pat = PatKind::Mac(codemap::Spanned {node: mac,
|
pat = PatKind::Mac(codemap::Spanned {node: mac,
|
||||||
span: mk_sp(lo, self.last_span.hi)});
|
span: mk_sp(lo, self.last_span.hi)});
|
||||||
} else {
|
} else {
|
||||||
@@ -3979,7 +3979,7 @@ impl<'a> Parser<'a> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if id.name == keywords::Invalid.name() {
|
if id.name == keywords::Invalid.name() {
|
||||||
let mac = P(spanned(lo, hi, Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT }));
|
let mac = P(spanned(lo, hi, Mac_ { path: pth, tts: tts }));
|
||||||
let stmt = StmtKind::Mac(mac, style, attrs.into_thin_attrs());
|
let stmt = StmtKind::Mac(mac, style, attrs.into_thin_attrs());
|
||||||
spanned(lo, hi, stmt)
|
spanned(lo, hi, stmt)
|
||||||
} else {
|
} else {
|
||||||
@@ -4000,7 +4000,7 @@ impl<'a> Parser<'a> {
|
|||||||
self.mk_item(
|
self.mk_item(
|
||||||
lo, hi, id /*id is good here*/,
|
lo, hi, id /*id is good here*/,
|
||||||
ItemKind::Mac(spanned(lo, hi,
|
ItemKind::Mac(spanned(lo, hi,
|
||||||
Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT })),
|
Mac_ { path: pth, tts: tts })),
|
||||||
Visibility::Inherited, attrs)))),
|
Visibility::Inherited, attrs)))),
|
||||||
ast::DUMMY_NODE_ID))
|
ast::DUMMY_NODE_ID))
|
||||||
}
|
}
|
||||||
@@ -4913,7 +4913,7 @@ impl<'a> Parser<'a> {
|
|||||||
let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
|
let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
|
||||||
SeqSep::none(),
|
SeqSep::none(),
|
||||||
|p| p.parse_token_tree())?;
|
|p| p.parse_token_tree())?;
|
||||||
let m_ = Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT };
|
let m_ = Mac_ { path: pth, tts: tts };
|
||||||
let m: ast::Mac = codemap::Spanned { node: m_,
|
let m: ast::Mac = codemap::Spanned { node: m_,
|
||||||
span: mk_sp(lo,
|
span: mk_sp(lo,
|
||||||
self.last_span.hi) };
|
self.last_span.hi) };
|
||||||
@@ -6002,7 +6002,7 @@ impl<'a> Parser<'a> {
|
|||||||
SeqSep::none(),
|
SeqSep::none(),
|
||||||
|p| p.parse_token_tree())?;
|
|p| p.parse_token_tree())?;
|
||||||
// single-variant-enum... :
|
// single-variant-enum... :
|
||||||
let m = Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT };
|
let m = Mac_ { path: pth, tts: tts };
|
||||||
let m: ast::Mac = codemap::Spanned { node: m,
|
let m: ast::Mac = codemap::Spanned { node: m,
|
||||||
span: mk_sp(mac_lo,
|
span: mk_sp(mac_lo,
|
||||||
self.last_span.hi) };
|
self.last_span.hi) };
|
||||||
|
|||||||
Reference in New Issue
Block a user