From a63780afcee53489e2f1640245d3b7c496dbe071 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Tue, 7 Feb 2012 11:31:15 -0800 Subject: Minor class-related tweaks to the AST --- src/comp/syntax/parse/parser.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/comp/syntax/parse') diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 33b6432a09c..dab6be43e2f 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -1965,6 +1965,7 @@ fn parse_item_class(p: parser, attrs: [ast::attribute]) -> @ast::item { let ty_params = parse_ty_params(p); expect(p, token::LBRACE); let items: [@ast::class_item] = []; + let ctor_id = p.get_id(); let the_ctor : option<(ast::fn_decl, ast::blk)> = none; while p.token != token::RBRACE { alt parse_class_item(p) { @@ -1972,12 +1973,12 @@ fn parse_item_class(p: parser, attrs: [ast::attribute]) -> @ast::item { the_ctor = some((a_fn_decl, blk)); } plain_decl(a_decl) { - items += [@{node: {privacy: ast::pub, decl: a_decl}, + items += [@{node: {privacy: ast::pub, decl: *a_decl}, span: p.last_span}]; } priv_decls(some_decls) { items += vec::map(some_decls, {|d| - @{node: {privacy: ast::priv, decl: d}, + @{node: {privacy: ast::priv, decl: *d}, span: p.last_span}}); } } @@ -1985,7 +1986,8 @@ fn parse_item_class(p: parser, attrs: [ast::attribute]) -> @ast::item { p.bump(); alt the_ctor { some((ct_d, ct_b)) { ret mk_item(p, lo, p.last_span.hi, class_name, - ast::item_class(ty_params, items, ct_d, ct_b), attrs); } + ast::item_class(ty_params, items, ctor_id, + ct_d, ct_b), attrs); } /* Is it strange for the parser to check this? */ -- cgit 1.4.1-3-g733a5