diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-01-11 09:58:05 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-01-13 06:27:34 -0800 |
| commit | 455f8b0d4588b6d890ce8a908d488c0325e3f29e (patch) | |
| tree | 9da702ded644a4d6eabe0936949060ca0ecc1c9d /src/comp/syntax/parse/parser.rs | |
| parent | d2be5b6c7a20b8b33f61cd0db4a3cbbdd7a5448a (diff) | |
| download | rust-455f8b0d4588b6d890ce8a908d488c0325e3f29e.tar.gz rust-455f8b0d4588b6d890ce8a908d488c0325e3f29e.zip | |
deprecate fn exprs and the fn() type, preferring fn@ and native fn
Diffstat (limited to 'src/comp/syntax/parse/parser.rs')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index 57f21e6113b..3a7f85b56c4 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -480,14 +480,21 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty { expect(p, token::RBRACKET); } else if eat_word(p, "fn") { let proto = parse_fn_ty_proto(p); + alt proto { + ast::proto_bare. { p.warn("fn is deprecated, use native fn"); } + _ { /* fallthrough */ } + } t = parse_ty_fn(proto, p); } else if eat_word(p, "block") { t = parse_ty_fn(ast::proto_block, p); + } else if eat_word(p, "native") { + expect_word(p, "fn"); + t = parse_ty_fn(ast::proto_bare, p); } else if eat_word(p, "lambda") { - //(breaks prettyprinting!) p.warn("lambda is deprecated, use fn@"); + p.warn("lambda is deprecated, use fn@"); t = parse_ty_fn(ast::proto_box, p); } else if eat_word(p, "sendfn") { - //(breaks prettyprinting!) p.warn("sendfn is deprecated, use fn~"); + p.warn("sendfn is deprecated, use fn~"); t = parse_ty_fn(ast::proto_uniq, p); } else if p.token == token::MOD_SEP || is_ident(p.token) { let path = parse_path(p); @@ -786,6 +793,10 @@ fn parse_bottom_expr(p: parser) -> pexpr { ret pexpr(parse_alt_expr(p)); } else if eat_word(p, "fn") { let proto = parse_fn_ty_proto(p); + alt proto { + ast::proto_bare. { p.warn("fn expr are deprecated, use fn@"); } + _ { /* fallthrough */ } + } ret pexpr(parse_fn_expr(p, proto)); } else if eat_word(p, "block") { ret pexpr(parse_fn_expr(p, ast::proto_block)); |
