Parse obj methods as proto_bare
I don't know if this is the right thing to do, but it works and it lets 'fn' always mean proto_bare
This commit is contained in:
parent
391e12124b
commit
f324704c0a
2 changed files with 9 additions and 11 deletions
|
@ -281,7 +281,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
|
||||||
let proto;
|
let proto;
|
||||||
alt next(st) as char {
|
alt next(st) as char {
|
||||||
'W' { proto = ast::proto_iter; }
|
'W' { proto = ast::proto_iter; }
|
||||||
'F' { proto = ast::proto_fn; }
|
'f' { proto = ast::proto_bare; }
|
||||||
}
|
}
|
||||||
let name = "";
|
let name = "";
|
||||||
while peek(st) as char != '[' {
|
while peek(st) as char != '[' {
|
||||||
|
|
|
@ -294,16 +294,6 @@ fn parse_ty_fn(proto: ast::proto, p: parser) -> ast::ty_ {
|
||||||
ret ast::ty_fn(proto, inputs.node, ret_ty, ret_style, constrs);
|
ret ast::ty_fn(proto, inputs.node, ret_ty, ret_style, constrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_method_proto(p: parser) -> ast::proto {
|
|
||||||
if eat_word(p, "iter") {
|
|
||||||
ret ast::proto_iter;
|
|
||||||
} else if eat_word(p, "fn") {
|
|
||||||
ret ast::proto_fn;
|
|
||||||
} else if eat_word(p, "block") {
|
|
||||||
ret ast::proto_block;
|
|
||||||
} else { unexpected(p, p.peek()); }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_ty_obj(p: parser, &hi: uint) -> ast::ty_ {
|
fn parse_ty_obj(p: parser, &hi: uint) -> ast::ty_ {
|
||||||
fn parse_method_sig(p: parser) -> ast::ty_method {
|
fn parse_method_sig(p: parser) -> ast::ty_method {
|
||||||
let flo = p.get_lo_pos();
|
let flo = p.get_lo_pos();
|
||||||
|
@ -2179,6 +2169,14 @@ fn parse_fn_anon_proto(p: parser) -> ast::proto {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_method_proto(p: parser) -> ast::proto {
|
||||||
|
if eat_word(p, "iter") {
|
||||||
|
ret ast::proto_iter;
|
||||||
|
} else if eat_word(p, "fn") {
|
||||||
|
ret ast::proto_bare;
|
||||||
|
} else { unexpected(p, p.peek()); }
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> {
|
fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> {
|
||||||
if eat_word(p, "const") {
|
if eat_word(p, "const") {
|
||||||
ret some(parse_item_const(p, attrs));
|
ret some(parse_item_const(p, attrs));
|
||||||
|
|
Loading…
Reference in a new issue