refactor ascription
This commit is contained in:
parent
f843f23aba
commit
2a2815266b
@ -13,8 +13,7 @@ fn const_or_static(p: &mut Parser, kw: SyntaxKind) {
|
||||
p.bump();
|
||||
p.eat(MUT_KW); // TODO: validator to forbid const mut
|
||||
name(p);
|
||||
p.expect(COLON);
|
||||
types::type_(p);
|
||||
types::ascription(p);
|
||||
p.expect(EQ);
|
||||
expressions::expr(p);
|
||||
p.expect(SEMI);
|
||||
|
@ -279,8 +279,8 @@ fn let_stmt(p: &mut Parser) {
|
||||
let m = p.start();
|
||||
p.bump();
|
||||
patterns::pattern(p);
|
||||
if p.eat(COLON) {
|
||||
types::type_(p);
|
||||
if p.at(COLON) {
|
||||
types::ascription(p);
|
||||
}
|
||||
if p.eat(EQ) {
|
||||
expressions::expr(p);
|
||||
|
@ -17,6 +17,11 @@ pub(super) fn type_(p: &mut Parser) {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn ascription(p: &mut Parser) {
|
||||
p.expect(COLON);
|
||||
type_(p)
|
||||
}
|
||||
|
||||
fn type_no_plus(p: &mut Parser) {
|
||||
type_(p);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user