diff options
| author | Lindsey Kuper <[email protected]> | 2011-03-29 15:51:53 -0700 |
|---|---|---|
| committer | Lindsey Kuper <[email protected]> | 2011-03-29 15:59:15 -0700 |
| commit | 55fbed3d8d7078bfd3864e64cc044cbe876c5d1a (patch) | |
| tree | 3c0a53f8f59dbda781fda2a7ad1e5afcce719de2 /src/comp/front/parser.rs | |
| parent | Ignore 'mutable foo' in plain field contexts. (diff) | |
| download | rust-55fbed3d8d7078bfd3864e64cc044cbe876c5d1a.tar.xz rust-55fbed3d8d7078bfd3864e64cc044cbe876c5d1a.zip | |
Beginnings of support for magical self prefix; nothing profound happening yet.
Diffstat (limited to 'src/comp/front/parser.rs')
| -rw-r--r-- | src/comp/front/parser.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 7bec44e6..25c9f4a5 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -883,6 +883,20 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr { ex = ast.expr_chan(e, ast.ann_none); } + case (token.SELF) { + p.bump(); + expect(p, token.DOT); + // The rest is a call expression. + auto e = parse_bottom_expr(p); + auto pf = parse_expr; + auto es = parse_seq[@ast.expr](token.LPAREN, + token.RPAREN, + some(token.COMMA), + pf, p); + hi = es.span; + auto ex = ast.expr_call_self(e, es.node, ast.ann_none); + } + case (_) { auto lit = parse_lit(p); hi = lit.span; @@ -1646,6 +1660,7 @@ fn stmt_ends_with_semi(@ast.stmt stmt) -> bool { case (ast.expr_tup(_,_)) { ret true; } case (ast.expr_rec(_,_,_)) { ret true; } case (ast.expr_call(_,_,_)) { ret true; } + case (ast.expr_call_self(_,_,_)){ ret true; } case (ast.expr_binary(_,_,_,_)) { ret true; } case (ast.expr_unary(_,_,_)) { ret true; } case (ast.expr_lit(_,_)) { ret true; } |