diff options
| author | Marijn Haverbeke <marijnh@gmail.com> | 2011-12-14 15:23:11 +0100 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2011-12-16 11:46:57 +0100 |
| commit | 7efef989011307bb9bb1679c9022c17bffecd2f6 (patch) | |
| tree | 9d7138daf99bb6171809ccb1258fb770bac2edcc /src/comp/syntax/parse | |
| parent | 1dd2f1ec03f41e9ce15fdfe2c729b74f74df2e64 (diff) | |
| download | rust-7efef989011307bb9bb1679c9022c17bffecd2f6.tar.gz rust-7efef989011307bb9bb1679c9022c17bffecd2f6.zip | |
Make uses of self in impls compile
Get rid of expr_self_call, introduces def_self. `self` is now, syntactically, simply a variable. A method implicitly brings a `self` binding into scope. Issue #1227
Diffstat (limited to 'src/comp/syntax/parse')
| -rw-r--r-- | src/comp/syntax/parse/parser.rs | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs index d1e11bf8700..94a7c3e01b2 100644 --- a/src/comp/syntax/parse/parser.rs +++ b/src/comp/syntax/parse/parser.rs @@ -155,8 +155,7 @@ fn bad_expr_word_table() -> hashmap<str, ()> { "cont", "ret", "be", "fail", "type", "resource", "check", "assert", "claim", "native", "fn", "lambda", "pure", "unsafe", "block", "import", "export", "let", "const", - "log", "log_err", "tag", "obj", "self", "copy", "sendfn", - "impl"] { + "log", "log_err", "tag", "obj", "copy", "sendfn", "impl"] { words.insert(word, ()); } words @@ -942,15 +941,6 @@ fn parse_bottom_expr(p: parser) -> @ast::expr { let e = parse_expr(p); ex = ast::expr_copy(e); hi = e.span.hi; - } else if is_word(p, "self") && p.look_ahead(1u) == token::DOT { - p.bump(); p.bump(); - // The rest is a call expression. - let f: @ast::expr = parse_self_method(p); - let es = - parse_seq(token::LPAREN, token::RPAREN, seq_sep(token::COMMA), - parse_expr, p); - hi = es.span.hi; - ex = ast::expr_call(f, es.node, false); } else if p.peek() == token::MOD_SEP || is_ident(p.peek()) && !is_word(p, "true") && !is_word(p, "false") { @@ -998,12 +988,6 @@ fn parse_syntax_ext_naked(p: parser, lo: uint) -> @ast::expr { ret mk_mac_expr(p, lo, hi, ast::mac_invoc(pth, e, none)); } -fn parse_self_method(p: parser) -> @ast::expr { - let sp = p.get_span(); - let f_name: ast::ident = parse_ident(p); - ret mk_expr(p, sp.lo, sp.hi, ast::expr_self_method(f_name)); -} - fn parse_dot_or_call_expr(p: parser) -> @ast::expr { let b = parse_bottom_expr(p); if expr_has_value(b) { parse_dot_or_call_expr_with(p, b) } |
