diff options
| author | Patrick Walton <[email protected]> | 2011-04-06 10:25:32 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-04-06 10:25:32 -0700 |
| commit | d9da43984b5e9d50f711320d2afc3307537dfb44 (patch) | |
| tree | 6b9b3eefc8909c7621c01b7e039375deb019e7b1 /src/comp/front | |
| parent | rustc: Make type_of() return the type of the wrapper for native functions. li... (diff) | |
| parent | Minimal testcase for next bootstrap blocker. (diff) | |
| download | rust-d9da43984b5e9d50f711320d2afc3307537dfb44.tar.xz rust-d9da43984b5e9d50f711320d2afc3307537dfb44.zip | |
Merge branch 'master' of github.com:graydon/rust
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 9 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 9 | ||||
| -rw-r--r-- | src/comp/front/token.rs | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 46666a34..d41e6d60 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -188,7 +188,7 @@ fn binop_to_str(binop op) -> str { tag unop { - box; + box(mutability); deref; bitnot; not; @@ -197,7 +197,10 @@ tag unop { fn unop_to_str(unop op) -> str { alt (op) { - case (box) {ret "@";} + case (box(?mt)) { + if (mt == mut) { ret "@mutable"; } + ret "@"; + } case (deref) {ret "*";} case (bitnot) {ret "~";} case (not) {ret "!";} @@ -255,7 +258,7 @@ tag expr_ { expr_tup(vec[elt], ann); expr_rec(vec[field], option.t[@expr], ann); expr_call(@expr, vec[@expr], ann); - expr_call_self(@expr, vec[@expr], ann); + expr_call_self(ident, vec[@expr], ann); expr_bind(@expr, vec[option.t[@expr]], ann); expr_spawn(spawn_dom, option.t[str], @expr, vec[@expr], ann); expr_binary(binop, @expr, @expr, ann); diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index 4c3e6cf0..27fdc7fe 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -887,17 +887,19 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr { } case (token.SELF) { + log "parsing a self-call..."; + p.bump(); expect(p, token.DOT); // The rest is a call expression. - auto e = parse_bottom_expr(p); + auto e = parse_ident(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); + ex = ast.expr_call_self(e, es.node, ast.ann_none); } case (_) { @@ -1074,9 +1076,10 @@ impure fn parse_prefix_expr(parser p) -> @ast.expr { case (token.AT) { p.bump(); + auto m = parse_mutability(p); auto e = parse_prefix_expr(p); hi = e.span; - ex = ast.expr_unary(ast.box, e, ast.ann_none); + ex = ast.expr_unary(ast.box(m), e, ast.ann_none); } case (_) { diff --git a/src/comp/front/token.rs b/src/comp/front/token.rs index 5ac9d662..dcfafadf 100644 --- a/src/comp/front/token.rs +++ b/src/comp/front/token.rs @@ -348,6 +348,8 @@ fn to_str(token t) -> str { /* Object type */ case (OBJ) { ret "obj"; } + case (SELF) { ret "self"; } + /* Comm and task types */ case (CHAN) { ret "chan"; } |