better self-types
This commit is contained in:
@@ -208,7 +208,7 @@ fn extern_crate_item(p: &mut Parser) {
|
||||
assert!(p.at(CRATE_KW));
|
||||
p.bump();
|
||||
name(p);
|
||||
alias(p);
|
||||
opt_alias(p);
|
||||
p.expect(SEMI);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ fn use_tree(p: &mut Parser) {
|
||||
paths::use_path(p);
|
||||
match p.current() {
|
||||
AS_KW => {
|
||||
alias(p);
|
||||
opt_alias(p);
|
||||
}
|
||||
COLONCOLON => {
|
||||
p.bump();
|
||||
|
||||
@@ -92,14 +92,14 @@ fn opt_visibility(p: &mut Parser) {
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
fn alias(p: &mut Parser) -> bool {
|
||||
|
||||
fn opt_alias(p: &mut Parser) {
|
||||
if p.at(AS_KW) {
|
||||
let alias = p.start();
|
||||
let m = p.start();
|
||||
p.bump();
|
||||
name(p);
|
||||
alias.complete(p, ALIAS);
|
||||
m.complete(p, ALIAS);
|
||||
}
|
||||
true //FIXME: return false if three are errors
|
||||
}
|
||||
|
||||
fn abi(p: &mut Parser) {
|
||||
|
||||
@@ -92,16 +92,18 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) {
|
||||
// fn b(&self,) {}
|
||||
// fn c(&'a self,) {}
|
||||
// fn d(&'a mut self, x: i32) {}
|
||||
// fn e(mut self) {}
|
||||
// }
|
||||
fn self_param(p: &mut Parser) {
|
||||
let m;
|
||||
if p.at(SELF_KW) {
|
||||
if p.at(SELF_KW) || p.at(MUT_KW) && p.nth(1) == SELF_KW {
|
||||
m = p.start();
|
||||
p.bump();
|
||||
p.eat(MUT_KW);
|
||||
p.eat(SELF_KW);
|
||||
// test arb_self_types
|
||||
// impl S {
|
||||
// fn a(self: &Self) {}
|
||||
// fn b(self: Box<Self>) {}
|
||||
// fn b(mut self: Box<Self>) {}
|
||||
// }
|
||||
if p.at(COLON) {
|
||||
types::ascription(p);
|
||||
|
||||
Reference in New Issue
Block a user