aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/parser/grammar/items/consts.rs3
-rw-r--r--src/parser/grammar/items/mod.rs4
-rw-r--r--src/parser/grammar/types.rs5
3 files changed, 8 insertions, 4 deletions
diff --git a/src/parser/grammar/items/consts.rs b/src/parser/grammar/items/consts.rs
index d6c3753b3..ca26a7814 100644
--- a/src/parser/grammar/items/consts.rs
+++ b/src/parser/grammar/items/consts.rs
@@ -13,8 +13,7 @@ fn const_or_static(p: &mut Parser, kw: SyntaxKind) {
13 p.bump(); 13 p.bump();
14 p.eat(MUT_KW); // TODO: validator to forbid const mut 14 p.eat(MUT_KW); // TODO: validator to forbid const mut
15 name(p); 15 name(p);
16 p.expect(COLON); 16 types::ascription(p);
17 types::type_(p);
18 p.expect(EQ); 17 p.expect(EQ);
19 expressions::expr(p); 18 expressions::expr(p);
20 p.expect(SEMI); 19 p.expect(SEMI);
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs
index 00c52dc09..0d9eccd2f 100644
--- a/src/parser/grammar/items/mod.rs
+++ b/src/parser/grammar/items/mod.rs
@@ -279,8 +279,8 @@ fn fn_item(p: &mut Parser) {
279 let m = p.start(); 279 let m = p.start();
280 p.bump(); 280 p.bump();
281 patterns::pattern(p); 281 patterns::pattern(p);
282 if p.eat(COLON) { 282 if p.at(COLON) {
283 types::type_(p); 283 types::ascription(p);
284 } 284 }
285 if p.eat(EQ) { 285 if p.eat(EQ) {
286 expressions::expr(p); 286 expressions::expr(p);
diff --git a/src/parser/grammar/types.rs b/src/parser/grammar/types.rs
index bcdc3ef97..014086521 100644
--- a/src/parser/grammar/types.rs
+++ b/src/parser/grammar/types.rs
@@ -17,6 +17,11 @@ pub(super) fn type_(p: &mut Parser) {
17 } 17 }
18} 18}
19 19
20pub(super) fn ascription(p: &mut Parser) {
21 p.expect(COLON);
22 type_(p)
23}
24
20fn type_no_plus(p: &mut Parser) { 25fn type_no_plus(p: &mut Parser) {
21 type_(p); 26 type_(p);
22} 27}