Skip to content

Commit

Permalink
Refactor away field ctxt of ast::Mac_
Browse files Browse the repository at this point in the history
  • Loading branch information
jseyfried committed Jun 14, 2016
1 parent 01a0877 commit febe6a4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,6 @@ pub type Mac = Spanned<Mac_>;
pub struct Mac_ {
pub path: Path,
pub tts: Vec<TokenTree>,
pub ctxt: SyntaxContext,
}

#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,6 @@ impl Folder for Marker {
node: Mac_ {
path: self.fold_path(node.path),
tts: self.fold_tts(&node.tts),
ctxt: mtwt::apply_mark(self.mark, node.ctxt),
},
span: self.new_span(span),
}
Expand Down
1 change: 0 additions & 1 deletion src/libsyntax/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,6 @@ pub fn noop_fold_mac<T: Folder>(Spanned {node, span}: Mac, fld: &mut T) -> Mac {
node: Mac_ {
path: fld.fold_path(node.path),
tts: fld.fold_tts(&node.tts),
ctxt: node.ctxt,
},
span: fld.new_span(span)
}
Expand Down
16 changes: 8 additions & 8 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ast::Block;
use ast::{BlockCheckMode, CaptureBy};
use ast::{Constness, Crate, CrateConfig};
use ast::{Decl, DeclKind, Defaultness};
use ast::{EMPTY_CTXT, EnumDef};
use ast::EnumDef;
use ast::{Expr, ExprKind, RangeLimits};
use ast::{Field, FnDecl};
use ast::{ForeignItem, ForeignItemKind, FunctionRetTy};
Expand Down Expand Up @@ -1467,7 +1467,7 @@ impl<'a> Parser<'a> {
SeqSep::none(),
|p| p.parse_token_tree())?;
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 {
// NAMED TYPE
TyKind::Path(None, path)
Expand Down Expand Up @@ -2348,7 +2348,7 @@ impl<'a> Parser<'a> {

return Ok(self.mk_mac_expr(lo,
hi,
Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT },
Mac_ { path: pth, tts: tts },
attrs));
}
if self.check(&token::OpenDelim(token::Brace)) {
Expand Down Expand Up @@ -3661,7 +3661,7 @@ impl<'a> Parser<'a> {
let tts = self.parse_seq_to_end(
&token::CloseDelim(delim),
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,
span: mk_sp(lo, self.last_span.hi)});
} else {
Expand Down Expand Up @@ -3979,7 +3979,7 @@ impl<'a> Parser<'a> {
};

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());
spanned(lo, hi, stmt)
} else {
Expand All @@ -4000,7 +4000,7 @@ impl<'a> Parser<'a> {
self.mk_item(
lo, hi, id /*id is good here*/,
ItemKind::Mac(spanned(lo, hi,
Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT })),
Mac_ { path: pth, tts: tts })),
Visibility::Inherited, attrs)))),
ast::DUMMY_NODE_ID))
}
Expand Down Expand Up @@ -4913,7 +4913,7 @@ impl<'a> Parser<'a> {
let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
SeqSep::none(),
|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_,
span: mk_sp(lo,
self.last_span.hi) };
Expand Down Expand Up @@ -6002,7 +6002,7 @@ impl<'a> Parser<'a> {
SeqSep::none(),
|p| p.parse_token_tree())?;
// 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,
span: mk_sp(mac_lo,
self.last_span.hi) };
Expand Down

0 comments on commit febe6a4

Please sign in to comment.