about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-09-06 22:11:55 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-09-10 05:45:12 -0400
commita5ad4c379466519a0bf977864a5cdc50a7ade385 (patch)
tree177576d6ff2d94006334872769bbe760933b8d27 /src/libsyntax/parse
parented695d470bf1568b896f2944815f4723905ab66e (diff)
downloadrust-a5ad4c379466519a0bf977864a5cdc50a7ade385.tar.gz
rust-a5ad4c379466519a0bf977864a5cdc50a7ade385.zip
Delay assignment of node ids until after expansion. Ensures that each AST node
has a unique id. Fixes numerous bugs in macro expansion and deriving. Add two
representative tests.

Fixes #7971
Fixes #6304
Fixes #8367
Fixes #8754
Fixes #8852
Fixes #2543
Fixes #7654
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/mod.rs49
-rw-r--r--src/libsyntax/parse/parser.rs139
2 files changed, 86 insertions, 102 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index 5fa28ff21ae..f7c76fee180 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -11,7 +11,6 @@
 //! The main parser interface
 
 
-use ast::NodeId;
 use ast;
 use codemap::{Span, CodeMap, FileMap, FileSubstr};
 use codemap;
@@ -29,7 +28,6 @@ pub mod token;
 pub mod comments;
 pub mod attr;
 
-
 /// Common routines shared by parser mods
 pub mod common;
 
@@ -42,7 +40,6 @@ pub mod obsolete;
 // info about a parsing session.
 pub struct ParseSess {
     cm: @codemap::CodeMap, // better be the same as the one in the reader!
-    next_id: NodeId,
     span_diagnostic: @mut span_handler, // better be the same as the one in the reader!
     /// Used to determine and report recursive mod inclusions
     included_mod_stack: ~[Path],
@@ -52,7 +49,6 @@ pub fn new_parse_sess(demitter: Option<Emitter>) -> @mut ParseSess {
     let cm = @CodeMap::new();
     @mut ParseSess {
         cm: cm,
-        next_id: 1,
         span_diagnostic: mk_span_handler(mk_handler(demitter), cm),
         included_mod_stack: ~[],
     }
@@ -63,7 +59,6 @@ pub fn new_parse_sess_special_handler(sh: @mut span_handler,
                                    -> @mut ParseSess {
     @mut ParseSess {
         cm: cm,
-        next_id: 1,
         span_diagnostic: sh,
         included_mod_stack: ~[],
     }
@@ -201,15 +196,6 @@ pub fn parse_from_source_str<T>(
     maybe_aborted(r,p)
 }
 
-// return the next unused node id.
-pub fn next_node_id(sess: @mut ParseSess) -> NodeId {
-    let rv = sess.next_id;
-    sess.next_id += 1;
-    // ID 0 is reserved for the crate and doesn't actually exist in the AST
-    assert!(rv != 0);
-    return rv;
-}
-
 // Create a new parser from a source string
 pub fn new_parser_from_source_str(sess: @mut ParseSess,
                                   cfg: ast::CrateConfig,
@@ -364,7 +350,7 @@ mod test {
     #[test] fn path_exprs_1() {
         assert_eq!(string_to_expr(@"a"),
                    @ast::Expr{
-                    id: 1,
+                    id: ast::DUMMY_NODE_ID,
                     node: ast::ExprPath(ast::Path {
                         span: sp(0, 1),
                         global: false,
@@ -383,7 +369,7 @@ mod test {
     #[test] fn path_exprs_2 () {
         assert_eq!(string_to_expr(@"::a::b"),
                    @ast::Expr {
-                    id:1,
+                    id: ast::DUMMY_NODE_ID,
                     node: ast::ExprPath(ast::Path {
                             span: sp(0, 6),
                             global: true,
@@ -441,9 +427,9 @@ mod test {
     #[test] fn ret_expr() {
         assert_eq!(string_to_expr(@"return d"),
                    @ast::Expr{
-                    id:2,
+                    id: ast::DUMMY_NODE_ID,
                     node:ast::ExprRet(Some(@ast::Expr{
-                        id:1,
+                        id: ast::DUMMY_NODE_ID,
                         node:ast::ExprPath(ast::Path{
                             span: sp(7, 8),
                             global: false,
@@ -465,7 +451,7 @@ mod test {
         assert_eq!(string_to_stmt(@"b;"),
                    @Spanned{
                        node: ast::StmtExpr(@ast::Expr {
-                           id: 1,
+                           id: ast::DUMMY_NODE_ID,
                            node: ast::ExprPath(ast::Path {
                                span:sp(0,1),
                                global:false,
@@ -478,7 +464,7 @@ mod test {
                                ],
                             }),
                            span: sp(0,1)},
-                                            2), // fixme
+                                           ast::DUMMY_NODE_ID),
                        span: sp(0,1)})
 
     }
@@ -490,7 +476,7 @@ mod test {
     #[test] fn parse_ident_pat () {
         let parser = string_to_parser(@"b");
         assert_eq!(parser.parse_pat(),
-                   @ast::Pat{id:1, // fixme
+                   @ast::Pat{id: ast::DUMMY_NODE_ID,
                              node: ast::PatIdent(
                                 ast::BindInfer,
                                 ast::Path {
@@ -511,17 +497,16 @@ mod test {
 
     // check the contents of the tt manually:
     #[test] fn parse_fundecl () {
-        // this test depends on the intern order of "fn" and "int", and on the
-        // assignment order of the NodeIds.
+        // this test depends on the intern order of "fn" and "int"
         assert_eq!(string_to_item(@"fn a (b : int) { b; }"),
                   Some(
                       @ast::item{ident:str_to_ident("a"),
                             attrs:~[],
-                            id: 9, // fixme
+                            id: ast::DUMMY_NODE_ID,
                             node: ast::item_fn(ast::fn_decl{
                                 inputs: ~[ast::arg{
                                     is_mutbl: false,
-                                    ty: ast::Ty{id:3, // fixme
+                                    ty: ast::Ty{id: ast::DUMMY_NODE_ID,
                                                 node: ast::ty_path(ast::Path{
                                         span:sp(10,13),
                                         global:false,
@@ -533,11 +518,11 @@ mod test {
                                                 types: opt_vec::Empty,
                                             }
                                         ],
-                                        }, None, 2),
+                                        }, None, ast::DUMMY_NODE_ID),
                                         span:sp(10,13)
                                     },
                                     pat: @ast::Pat {
-                                        id:1, // fixme
+                                        id: ast::DUMMY_NODE_ID,
                                         node: ast::PatIdent(
                                             ast::BindInfer,
                                             ast::Path {
@@ -556,9 +541,9 @@ mod test {
                                         ),
                                         span: sp(6,7)
                                     },
-                                    id: 4 // fixme
+                                    id: ast::DUMMY_NODE_ID
                                 }],
-                                output: ast::Ty{id:5, // fixme
+                                output: ast::Ty{id: ast::DUMMY_NODE_ID,
                                                  node: ast::ty_nil,
                                                  span:sp(15,15)}, // not sure
                                 cf: ast::return_val
@@ -573,7 +558,7 @@ mod test {
                                         view_items: ~[],
                                         stmts: ~[@Spanned{
                                             node: ast::StmtSemi(@ast::Expr{
-                                                id: 6,
+                                                id: ast::DUMMY_NODE_ID,
                                                 node: ast::ExprPath(
                                                       ast::Path{
                                                         span:sp(17,18),
@@ -591,10 +576,10 @@ mod test {
                                                         ],
                                                       }),
                                                 span: sp(17,18)},
-                                                                 7), // fixme
+                                                ast::DUMMY_NODE_ID),
                                             span: sp(17,18)}],
                                         expr: None,
-                                        id: 8, // fixme
+                                        id: ast::DUMMY_NODE_ID,
                                         rules: ast::DefaultBlock, // no idea
                                         span: sp(15,21),
                                     }),
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 9410d0194c3..9a09a1d9cec 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -41,7 +41,7 @@ use ast::{lit_bool, lit_float, lit_float_unsuffixed, lit_int, lit_char};
 use ast::{lit_int_unsuffixed, lit_nil, lit_str, lit_uint, Local};
 use ast::{MutImmutable, MutMutable, mac_, mac_invoc_tt, matcher, match_nonterminal};
 use ast::{match_seq, match_tok, method, mt, BiMul, Mutability};
-use ast::{named_field, UnNeg, NodeId, noreturn, UnNot, Pat, PatBox, PatEnum};
+use ast::{named_field, UnNeg, noreturn, UnNot, Pat, PatBox, PatEnum};
 use ast::{PatIdent, PatLit, PatRange, PatRegion, PatStruct};
 use ast::{PatTup, PatUniq, PatWild, private};
 use ast::{BiRem, required};
@@ -76,7 +76,7 @@ use parse::token::{is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
 use parse::token::{token_to_binop};
 use parse::token;
-use parse::{new_sub_parser_from_file, next_node_id, ParseSess};
+use parse::{new_sub_parser_from_file, ParseSess};
 use opt_vec;
 use opt_vec::OptVec;
 
@@ -507,7 +507,7 @@ impl Parser {
         let ident = self.parse_ident();
         let hi = self.last_span.hi;
         spanned(lo, hi, ast::path_list_ident_ { name: ident,
-                                                id: self.get_id() })
+                                                id: ast::DUMMY_NODE_ID })
     }
 
     // consume token 'tok' if it exists. Returns true if the given
@@ -758,7 +758,6 @@ impl Parser {
     pub fn abort_if_errors(&self) {
         self.sess.span_diagnostic.handler().abort_if_errors();
     }
-    pub fn get_id(&self) -> NodeId { next_node_id(self.sess) }
 
     pub fn id_to_str(&self, id: Ident) -> @str {
         get_ident_interner().get(id.name)
@@ -961,7 +960,7 @@ impl Parser {
                     decl: d,
                     generics: generics,
                     explicit_self: explicit_self,
-                    id: p.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     span: mk_sp(lo, hi)
                 })
               }
@@ -978,9 +977,9 @@ impl Parser {
                     purity: pur,
                     decl: d,
                     body: body,
-                    id: p.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     span: mk_sp(lo, hi),
-                    self_id: p.get_id(),
+                    self_id: ast::DUMMY_NODE_ID,
                     vis: vis,
                 })
               }
@@ -1028,7 +1027,7 @@ impl Parser {
                 (
                     noreturn,
                     Ty {
-                        id: self.get_id(),
+                        id: ast::DUMMY_NODE_ID,
                         node: ty_bot,
                         span: mk_sp(lo, self.last_span.hi)
                     }
@@ -1041,7 +1040,7 @@ impl Parser {
             (
                 return_val,
                 Ty {
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     node: ty_nil,
                     span: mk_sp(pos, pos),
                 }
@@ -1154,14 +1153,14 @@ impl Parser {
                 path,
                 bounds
             } = self.parse_path(LifetimeAndTypesAndBounds);
-            ty_path(path, bounds, self.get_id())
+            ty_path(path, bounds, ast::DUMMY_NODE_ID)
         } else {
             self.fatal(fmt!("expected type, found token %?",
                             *self.token));
         };
 
         let sp = mk_sp(lo, self.last_span.hi);
-        Ty {id: self.get_id(), node: t, span: sp}
+        Ty {id: ast::DUMMY_NODE_ID, node: t, span: sp}
     }
 
     // parse the type following a @ or a ~
@@ -1275,7 +1274,7 @@ impl Parser {
             pat
         } else {
             debug!("parse_arg_general ident_to_pat");
-            ast_util::ident_to_pat(self.get_id(),
+            ast_util::ident_to_pat(ast::DUMMY_NODE_ID,
                                    *self.last_span,
                                    special_idents::invalid)
         };
@@ -1286,7 +1285,7 @@ impl Parser {
             is_mutbl: is_mutbl,
             ty: t,
             pat: pat,
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
         }
     }
 
@@ -1304,7 +1303,7 @@ impl Parser {
             self.parse_ty(false)
         } else {
             Ty {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: ty_infer,
                 span: mk_sp(self.span.lo, self.span.hi),
             }
@@ -1313,7 +1312,7 @@ impl Parser {
             is_mutbl: is_mutbl,
             ty: t,
             pat: pat,
-            id: self.get_id()
+            id: ast::DUMMY_NODE_ID
         })
     }
 
@@ -1562,7 +1561,7 @@ impl Parser {
                 let span = self.span;
                 self.bump();
                 return ast::Lifetime {
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     span: *span,
                     ident: i
                 };
@@ -1575,7 +1574,7 @@ impl Parser {
                 self.expect(&token::BINOP(token::SLASH));
                 self.obsolete(*self.last_span, ObsoleteLifetimeNotation);
                 return ast::Lifetime {
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     span: *span,
                     ident: i
                 };
@@ -1654,18 +1653,18 @@ impl Parser {
 
     pub fn mk_expr(&self, lo: BytePos, hi: BytePos, node: Expr_) -> @Expr {
         @Expr {
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             node: node,
             span: mk_sp(lo, hi),
         }
     }
 
     pub fn mk_unary(&self, unop: ast::UnOp, expr: @Expr) -> ast::Expr_ {
-        ExprUnary(self.get_id(), unop, expr)
+        ExprUnary(ast::DUMMY_NODE_ID, unop, expr)
     }
 
     pub fn mk_binary(&self, binop: ast::BinOp, lhs: @Expr, rhs: @Expr) -> ast::Expr_ {
-        ExprBinary(self.get_id(), binop, lhs, rhs)
+        ExprBinary(ast::DUMMY_NODE_ID, binop, lhs, rhs)
     }
 
     pub fn mk_call(&self, f: @Expr, args: ~[@Expr], sugar: CallSugar) -> ast::Expr_ {
@@ -1678,11 +1677,11 @@ impl Parser {
                       tps: ~[Ty],
                       args: ~[@Expr],
                       sugar: CallSugar) -> ast::Expr_ {
-        ExprMethodCall(self.get_id(), rcvr, ident, tps, args, sugar)
+        ExprMethodCall(ast::DUMMY_NODE_ID, rcvr, ident, tps, args, sugar)
     }
 
     pub fn mk_index(&self, expr: @Expr, idx: @Expr) -> ast::Expr_ {
-        ExprIndex(self.get_id(), expr, idx)
+        ExprIndex(ast::DUMMY_NODE_ID, expr, idx)
     }
 
     pub fn mk_field(&self, expr: @Expr, ident: Ident, tys: ~[Ty]) -> ast::Expr_ {
@@ -1690,12 +1689,12 @@ impl Parser {
     }
 
     pub fn mk_assign_op(&self, binop: ast::BinOp, lhs: @Expr, rhs: @Expr) -> ast::Expr_ {
-        ExprAssignOp(self.get_id(), binop, lhs, rhs)
+        ExprAssignOp(ast::DUMMY_NODE_ID, binop, lhs, rhs)
     }
 
     pub fn mk_mac_expr(&self, lo: BytePos, hi: BytePos, m: mac_) -> @Expr {
         @Expr {
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             node: ExprMac(codemap::Spanned {node: m, span: mk_sp(lo, hi)}),
             span: mk_sp(lo, hi),
         }
@@ -1709,7 +1708,7 @@ impl Parser {
         };
 
         @Expr {
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             node: ExprLit(lv_lit),
             span: *span,
         }
@@ -2415,7 +2414,7 @@ impl Parser {
                       ast::fn_decl {
                           inputs: ~[],
                           output: Ty {
-                              id: self.get_id(),
+                              id: ast::DUMMY_NODE_ID,
                               node: ty_infer,
                               span: *self.span
                           },
@@ -2450,7 +2449,7 @@ impl Parser {
             view_items: ~[],
             stmts: ~[],
             expr: Some(body),
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             rules: DefaultBlock,
             span: body.span,
         };
@@ -2631,7 +2630,7 @@ impl Parser {
                 view_items: ~[],
                 stmts: ~[],
                 expr: Some(expr),
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 rules: DefaultBlock,
                 span: expr.span,
             };
@@ -2764,7 +2763,7 @@ impl Parser {
                 subpat = self.parse_pat();
             } else {
                 subpat = @ast::Pat {
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     node: PatIdent(BindInfer, fieldpath, None),
                     span: *self.last_span
                 };
@@ -2788,7 +2787,7 @@ impl Parser {
             pat = PatWild;
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -2806,7 +2805,7 @@ impl Parser {
                     span: _}), _
               }) => {
                 let vst = @Expr {
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     node: ExprVstore(e, ExprVstoreBox),
                     span: mk_sp(lo, hi),
                 };
@@ -2816,7 +2815,7 @@ impl Parser {
             };
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -2834,7 +2833,7 @@ impl Parser {
                     span: _}), _
               }) => {
                 let vst = @Expr {
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     node: ExprVstore(e, ExprVstoreUniq),
                     span: mk_sp(lo, hi),
                 };
@@ -2844,7 +2843,7 @@ impl Parser {
             };
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -2862,7 +2861,7 @@ impl Parser {
                             node: lit_str(_), span: _}), _
                   }) => {
                       let vst = @Expr {
-                          id: self.get_id(),
+                          id: ast::DUMMY_NODE_ID,
                           node: ExprVstore(e, ExprVstoreSlice),
                           span: mk_sp(lo, hi)
                       };
@@ -2872,7 +2871,7 @@ impl Parser {
             };
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -2885,7 +2884,7 @@ impl Parser {
             pat = PatWild;
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -2915,7 +2914,7 @@ impl Parser {
             }
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -2930,7 +2929,7 @@ impl Parser {
             pat = ast::PatVec(before, slice, after);
             hi = self.last_span.hi;
             return @ast::Pat {
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 node: pat,
                 span: mk_sp(lo, hi)
             }
@@ -3046,7 +3045,7 @@ impl Parser {
         }
         hi = self.last_span.hi;
         @ast::Pat {
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             node: pat,
             span: mk_sp(lo, hi),
         }
@@ -3095,7 +3094,7 @@ impl Parser {
         }
 
         let mut ty = Ty {
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             node: ty_infer,
             span: mk_sp(lo, lo),
         };
@@ -3106,7 +3105,7 @@ impl Parser {
             ty: ty,
             pat: pat,
             init: init,
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             span: mk_sp(lo, self.last_span.hi),
         }
     }
@@ -3136,7 +3135,7 @@ impl Parser {
         let ty = self.parse_ty(false);
         @spanned(lo, self.last_span.hi, ast::struct_field_ {
             kind: named_field(name, pr),
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             ty: ty,
             attrs: attrs,
         })
@@ -3159,7 +3158,7 @@ impl Parser {
             check_expected_item(self, !item_attrs.is_empty());
             self.expect_keyword(keywords::Let);
             let decl = self.parse_let();
-            return @spanned(lo, decl.span.hi, StmtDecl(decl, self.get_id()));
+            return @spanned(lo, decl.span.hi, StmtDecl(decl, ast::DUMMY_NODE_ID));
         } else if is_ident(&*self.token)
             && !token::is_any_keyword(self.token)
             && self.look_ahead(1, |t| *t == token::NOT) {
@@ -3208,7 +3207,7 @@ impl Parser {
                             lo, hi, id /*id is good here*/,
                             item_mac(spanned(lo, hi, mac_invoc_tt(pth, tts, EMPTY_CTXT))),
                             inherited, ~[/*no attrs*/]))),
-                    self.get_id()));
+                    ast::DUMMY_NODE_ID));
             }
 
         } else {
@@ -3217,7 +3216,7 @@ impl Parser {
                 iovi_item(i) => {
                     let hi = i.span.hi;
                     let decl = @spanned(lo, hi, DeclItem(i));
-                    return @spanned(lo, hi, StmtDecl(decl, self.get_id()));
+                    return @spanned(lo, hi, StmtDecl(decl, ast::DUMMY_NODE_ID));
                 }
                 iovi_view_item(vi) => {
                     self.span_fatal(vi.span,
@@ -3233,7 +3232,7 @@ impl Parser {
 
             // Remainder are line-expr stmts.
             let e = self.parse_expr_res(RESTRICT_STMT_EXPR);
-            return @spanned(lo, e.span.hi, StmtExpr(e, self.get_id()));
+            return @spanned(lo, e.span.hi, StmtExpr(e, ast::DUMMY_NODE_ID));
         }
     }
 
@@ -3298,7 +3297,7 @@ impl Parser {
         for item in items.iter() {
             let decl = @spanned(item.span.lo, item.span.hi, DeclItem(*item));
             stmts.push(@spanned(item.span.lo, item.span.hi,
-                                StmtDecl(decl, self.get_id())));
+                                StmtDecl(decl, ast::DUMMY_NODE_ID)));
         }
 
         let mut attributes_box = attrs_remaining;
@@ -3397,7 +3396,7 @@ impl Parser {
             view_items: view_items,
             stmts: stmts,
             expr: expr,
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             rules: s,
             span: mk_sp(lo, hi),
         }
@@ -3463,7 +3462,7 @@ impl Parser {
         let opt_bounds = self.parse_optional_ty_param_bounds();
         // For typarams we don't care about the difference b/w "<T>" and "<T:>".
         let bounds = opt_bounds.unwrap_or_default(opt_vec::Empty);
-        ast::TyParam { ident: ident, id: self.get_id(), bounds: bounds }
+        ast::TyParam { ident: ident, id: ast::DUMMY_NODE_ID, bounds: bounds }
     }
 
     // parse a set of optional generic type parameter declarations
@@ -3717,7 +3716,7 @@ impl Parser {
         let output = if self.eat(&token::RARROW) {
             self.parse_ty(false)
         } else {
-            Ty { id: self.get_id(), node: ty_infer, span: *self.span }
+            Ty { id: ast::DUMMY_NODE_ID, node: ty_infer, span: *self.span }
         };
 
         ast::fn_decl {
@@ -3739,7 +3738,7 @@ impl Parser {
                attrs: ~[Attribute]) -> @item {
         @ast::item { ident: ident,
                      attrs: attrs,
-                     id: self.get_id(),
+                     id: ast::DUMMY_NODE_ID,
                      node: node,
                      vis: vis,
                      span: mk_sp(lo, hi) }
@@ -3779,9 +3778,9 @@ impl Parser {
             purity: pur,
             decl: decl,
             body: body,
-            id: self.get_id(),
+            id: ast::DUMMY_NODE_ID,
             span: mk_sp(lo, hi),
-            self_id: self.get_id(),
+            self_id: ast::DUMMY_NODE_ID,
             vis: visa,
         }
     }
@@ -3873,7 +3872,7 @@ impl Parser {
     fn parse_trait_ref(&self) -> trait_ref {
         ast::trait_ref {
             path: self.parse_path(LifetimeAndTypesWithoutColons).path,
-            ref_id: self.get_id(),
+            ref_id: ast::DUMMY_NODE_ID,
         }
     }
 
@@ -3926,7 +3925,7 @@ impl Parser {
                 let lo = p.span.lo;
                 let struct_field_ = ast::struct_field_ {
                     kind: unnamed_field,
-                    id: self.get_id(),
+                    id: ast::DUMMY_NODE_ID,
                     ty: p.parse_ty(false),
                     attrs: attrs,
                 };
@@ -3947,8 +3946,8 @@ impl Parser {
             );
         }
 
-        let _ = self.get_id();  // XXX: Workaround for crazy bug.
-        let new_id = self.get_id();
+        let _ = ast::DUMMY_NODE_ID;  // XXX: Workaround for crazy bug.
+        let new_id = ast::DUMMY_NODE_ID;
         (class_name,
          item_struct(@ast::struct_def {
              fields: fields,
@@ -4238,7 +4237,7 @@ impl Parser {
         @ast::foreign_item { ident: ident,
                              attrs: attrs,
                              node: foreign_item_fn(decl, generics),
-                             id: self.get_id(),
+                             id: ast::DUMMY_NODE_ID,
                              span: mk_sp(lo, hi),
                              vis: vis }
     }
@@ -4264,7 +4263,7 @@ impl Parser {
         @ast::foreign_item { ident: ident,
                              attrs: attrs,
                              node: foreign_item_static(ty, mutbl),
-                             id: self.get_id(),
+                             id: ast::DUMMY_NODE_ID,
                              span: mk_sp(lo, hi),
                              vis: vis }
     }
@@ -4386,7 +4385,7 @@ impl Parser {
         let metadata = self.parse_optional_meta();
         self.expect(&token::SEMI);
         iovi_view_item(ast::view_item {
-            node: view_item_extern_mod(ident, maybe_path, metadata, self.get_id()),
+            node: view_item_extern_mod(ident, maybe_path, metadata, ast::DUMMY_NODE_ID),
             attrs: attrs,
             vis: visibility,
             span: mk_sp(lo, self.last_span.hi)
@@ -4461,7 +4460,7 @@ impl Parser {
                 for ty in arg_tys.move_iter() {
                     args.push(ast::variant_arg {
                         ty: ty,
-                        id: self.get_id(),
+                        id: ast::DUMMY_NODE_ID,
                     });
                 }
                 kind = tuple_variant_kind(args);
@@ -4477,7 +4476,7 @@ impl Parser {
                 name: ident,
                 attrs: variant_attrs,
                 kind: kind,
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 disr_expr: disr_expr,
                 vis: vis,
             };
@@ -4509,9 +4508,9 @@ impl Parser {
                 name: id,
                 attrs: ~[],
                 kind: tuple_variant_kind(
-                    ~[ast::variant_arg {ty: ty, id: self.get_id()}]
+                    ~[ast::variant_arg {ty: ty, id: ast::DUMMY_NODE_ID}]
                 ),
-                id: self.get_id(),
+                id: ast::DUMMY_NODE_ID,
                 disr_expr: None,
                 vis: public,
             });
@@ -4886,7 +4885,7 @@ impl Parser {
             return @spanned(lo, self.span.hi,
                             view_path_simple(first_ident,
                                              path,
-                                             self.get_id()));
+                                             ast::DUMMY_NODE_ID));
           }
 
           token::MOD_SEP => {
@@ -4920,7 +4919,7 @@ impl Parser {
                         }).collect()
                     };
                     return @spanned(lo, self.span.hi,
-                                 view_path_list(path, idents, self.get_id()));
+                                 view_path_list(path, idents, ast::DUMMY_NODE_ID));
                   }
 
                   // foo::bar::*
@@ -4938,7 +4937,7 @@ impl Parser {
                         }).collect()
                     };
                     return @spanned(lo, self.span.hi,
-                                    view_path_glob(path, self.get_id()));
+                                    view_path_glob(path, ast::DUMMY_NODE_ID));
                   }
 
                   _ => break
@@ -4961,7 +4960,7 @@ impl Parser {
         };
         return @spanned(lo,
                         self.last_span.hi,
-                        view_path_simple(last, path, self.get_id()));
+                        view_path_simple(last, path, ast::DUMMY_NODE_ID));
     }
 
     // matches view_paths = view_path | view_path , view_paths
@@ -5008,7 +5007,7 @@ impl Parser {
             }
             else { None };
             let metadata = self.parse_optional_meta();
-            view_item_extern_mod(ident, path, metadata, self.get_id())
+            view_item_extern_mod(ident, path, metadata, ast::DUMMY_NODE_ID)
         } else {
             self.bug("expected view item");
         };