diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-02-07 11:31:15 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-02-07 12:15:59 -0800 |
| commit | a63780afcee53489e2f1640245d3b7c496dbe071 (patch) | |
| tree | 528c39b713494ffdd24ceae75f27188658f5dee7 /src/comp/syntax/parse | |
| parent | 47143ee24a135ee2a82864c9ff892fafe5cd262d (diff) | |
| download | rust-a63780afcee53489e2f1640245d3b7c496dbe071.tar.gz rust-a63780afcee53489e2f1640245d3b7c496dbe071.zip | |
Minor class-related tweaks to the AST
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 8 |
1 files changed, 5 insertions, 3 deletions
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? */ |
