diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-10-18 21:18:55 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-10-20 18:23:48 -0700 |
| commit | 9efdd0f3262ee30e614c14577dcc979a9ad68036 (patch) | |
| tree | ebefd06eb8533e45014663ef4060fea0deaa8e0a /src/comp/syntax | |
| parent | 4b30a06abe617f710b4d62aa134bc2af326b8f24 (diff) | |
| download | rust-9efdd0f3262ee30e614c14577dcc979a9ad68036.tar.gz rust-9efdd0f3262ee30e614c14577dcc979a9ad68036.zip | |
Merge ast::proto_shared and ast::proto_closure
Now they are both just proto_shared and proto_shared takes an argument indicating that it is sugared as 'lambda'
Diffstat (limited to 'src/comp/syntax')
| -rw-r--r-- | src/comp/syntax/ast.rs | 11 | ||||
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 11 | ||||
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 6 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/comp/syntax/ast.rs b/src/comp/syntax/ast.rs index 8ec411cff5e..80d6e7cb754 100644 --- a/src/comp/syntax/ast.rs +++ b/src/comp/syntax/ast.rs @@ -103,13 +103,16 @@ tag kind { kind_pinned; kind_shared; kind_unique; } tag _auth { auth_unsafe; } +tag proto_sugar { + sugar_normal; + sugar_sexy; +} + tag proto { proto_iter; - proto_shared; - proto_block; - // FIXME: Merge with proto_shared - proto_closure; proto_bare; + proto_shared(proto_sugar); + proto_block; } tag binop { diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 0f2c93756b7..4d48fd3c653 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -842,7 +842,7 @@ fn parse_bottom_expr(p: parser) -> @ast::expr { } else if eat_word(p, "block") { ret parse_fn_expr(p, ast::proto_block); } else if eat_word(p, "lambda") { - ret parse_fn_expr(p, ast::proto_closure); + ret parse_fn_expr(p, ast::proto_shared(ast::sugar_sexy)); } else if eat_word(p, "unchecked") { ret parse_block_expr(p, lo, ast::unchecked_blk); } else if eat_word(p, "unsafe") { @@ -1901,7 +1901,8 @@ fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item { il: ast::il_normal, cf: ast::return_val, constraints: []}; - let f = {decl: decl, proto: ast::proto_shared, body: dtor}; + let f = {decl: decl, proto: ast::proto_shared(ast::sugar_normal), + body: dtor}; ret mk_item(p, lo, dtor.span.hi, ident, ast::item_res(f, p.get_id(), ty_params, p.get_id()), attrs); } @@ -2140,7 +2141,7 @@ fn parse_fn_item_proto(p: parser) -> ast::proto { ast::proto_bare } else if p.peek() == token::AT { p.bump(); - ast::proto_shared + ast::proto_shared(ast::sugar_normal) } else { ast::proto_bare } @@ -2152,7 +2153,7 @@ fn parse_fn_ty_proto(p: parser) -> ast::proto { ast::proto_bare } else if p.peek() == token::AT { p.bump(); - ast::proto_shared + ast::proto_shared(ast::sugar_normal) } else { ast::proto_bare } @@ -2164,7 +2165,7 @@ fn parse_fn_anon_proto(p: parser) -> ast::proto { ast::proto_bare } else if p.peek() == token::AT { p.bump(); - ast::proto_shared + ast::proto_shared(ast::sugar_normal) } else { ast::proto_bare } diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index 4c4b66c59fe..76a2fd1d843 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -1643,11 +1643,11 @@ fn ast_fn_constrs_str(decl: ast::fn_decl, constrs: [@ast::constr]) -> str { fn proto_to_str(p: ast::proto) -> str { ret alt p { - ast::proto_shared. { "fn@" } ast::proto_iter. { "iter" } - ast::proto_block. { "block" } - ast::proto_closure. { "lambda" } ast::proto_bare. { "fn" } + ast::proto_block. { "block" } + ast::proto_shared(ast::sugar_normal.) { "fn@" } + ast::proto_shared(ast::sugar_sexy.) { "lambda" } }; } |
