diff options
| author | bors <bors@rust-lang.org> | 2013-09-06 23:35:57 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-06 23:35:57 -0700 |
| commit | 124eb2119c78651cfaaa7a046a101fa2e20f83ca (patch) | |
| tree | 7efa84a80df29080ae0314d0e3788131c72bdceb /src/libsyntax/parse/parser.rs | |
| parent | 3e6de6b7da8ee88bf84b0e217900051334be08da (diff) | |
| parent | b6f3d3f24546a525d1eb80923692c1296eddc4dc (diff) | |
| download | rust-124eb2119c78651cfaaa7a046a101fa2e20f83ca.tar.gz rust-124eb2119c78651cfaaa7a046a101fa2e20f83ca.zip | |
auto merge of #9026 : jbclements/rust/let-var-hygiene, r=jbclements
This is a rebase of my approved pull request from ... the end of June? It introduces hygiene for let-bound variables.
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 51c5522ae2f..8b11a25f13c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -21,7 +21,7 @@ use ast::{_mod, BiAdd, arg, Arm, Attribute, BindByRef, BindInfer}; 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 @@ impl Parser { |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 @@ impl Parser { 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())); } @@ -3518,7 +3518,10 @@ impl Parser { } fn is_self_ident(&self) -> bool { - *self.token == token::IDENT(special_idents::self_, false) + match *self.token { + token::IDENT(id, false) => id.name == special_idents::self_.name, + _ => false + } } fn expect_self_ident(&self) { @@ -4806,7 +4809,7 @@ impl Parser { _ => 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) }; |
