From 2a2815266b35de12bd3c48cc405e8b3e8fcf8885 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Jul 2018 15:35:59 +0300 Subject: refactor ascription --- src/parser/grammar/items/consts.rs | 3 +-- src/parser/grammar/items/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/parser/grammar/items') 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) { 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); 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) { 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); -- cgit v1.2.3