Skip to content

Commit f324704

Browse files
committed
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
1 parent 391e121 commit f324704

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

src/comp/metadata/tydecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
281281
let proto;
282282
alt next(st) as char {
283283
'W' { proto = ast::proto_iter; }
284-
'F' { proto = ast::proto_fn; }
284+
'f' { proto = ast::proto_bare; }
285285
}
286286
let name = "";
287287
while peek(st) as char != '[' {

src/comp/syntax/parse/parser.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -294,16 +294,6 @@ fn parse_ty_fn(proto: ast::proto, p: parser) -> ast::ty_ {
294294
ret ast::ty_fn(proto, inputs.node, ret_ty, ret_style, constrs);
295295
}
296296

297-
fn parse_method_proto(p: parser) -> ast::proto {
298-
if eat_word(p, "iter") {
299-
ret ast::proto_iter;
300-
} else if eat_word(p, "fn") {
301-
ret ast::proto_fn;
302-
} else if eat_word(p, "block") {
303-
ret ast::proto_block;
304-
} else { unexpected(p, p.peek()); }
305-
}
306-
307297
fn parse_ty_obj(p: parser, &hi: uint) -> ast::ty_ {
308298
fn parse_method_sig(p: parser) -> ast::ty_method {
309299
let flo = p.get_lo_pos();
@@ -2179,6 +2169,14 @@ fn parse_fn_anon_proto(p: parser) -> ast::proto {
21792169
}
21802170
}
21812171

2172+
fn parse_method_proto(p: parser) -> ast::proto {
2173+
if eat_word(p, "iter") {
2174+
ret ast::proto_iter;
2175+
} else if eat_word(p, "fn") {
2176+
ret ast::proto_bare;
2177+
} else { unexpected(p, p.peek()); }
2178+
}
2179+
21822180
fn parse_item(p: parser, attrs: [ast::attribute]) -> option::t<@ast::item> {
21832181
if eat_word(p, "const") {
21842182
ret some(parse_item_const(p, attrs));

0 commit comments

Comments
 (0)