Accept *foo as a pointer to foo.

This is accepted everywhere, since just passing a pointer is safe.
This commit is contained in:
Rafael Ávila de Espíndola 2011-06-03 14:34:19 -04:00
parent 07667d29aa
commit 18b63865ce
3 changed files with 12 additions and 0 deletions

View File

@ -323,6 +323,7 @@ tag ty_ {
ty_str;
ty_box(mt);
ty_vec(mt);
ty_ptr(mt);
ty_task;
ty_port(@ty);
ty_chan(@ty);

View File

@ -511,6 +511,11 @@ fn parse_ty(&parser p) -> @ast::ty {
auto mt = parse_mt(p);
hi = mt.ty.span.hi;
t = ast::ty_box(mt);
} else if (p.peek() == token::BINOP(token::STAR)) {
p.bump();
auto mt = parse_mt(p);
hi = mt.ty.span.hi;
t = ast::ty_ptr(mt);
} else if (eat_word(p, "vec")) {
expect(p, token::LBRACKET);
t = ast::ty_vec(parse_mt(p));

View File

@ -0,0 +1,6 @@
fn f(*int a) {
}
fn main(vec[str] args) {
ret;
}