From 9dcb79a60225cd127f1bd9f8653ff5da525d9af0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Jul 2018 14:00:22 +0300 Subject: Bare & default impls --- src/parser/grammar/items/mod.rs | 12 ++++++++++++ src/parser/grammar/items/traits.rs | 3 +++ 2 files changed, 15 insertions(+) (limited to 'src/parser') diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index c88e39596..73fd5235a 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs @@ -149,6 +149,18 @@ fn item(p: &mut Parser) { } } } + IMPL_KW => { + traits::impl_item(p); + IMPL_ITEM + } + // test default_impl + // default impl Foo {} + IDENT if p.at_contextual_kw("default") && la == IMPL_KW => { + p.bump_remap(DEFAULT_KW); + traits::impl_item(p); + IMPL_ITEM + } + FN_KW => { fn_item(p); FN_ITEM diff --git a/src/parser/grammar/items/traits.rs b/src/parser/grammar/items/traits.rs index 9961a88fe..7fd011ffd 100644 --- a/src/parser/grammar/items/traits.rs +++ b/src/parser/grammar/items/traits.rs @@ -8,6 +8,9 @@ pub(super) fn trait_item(p: &mut Parser) { p.expect(R_CURLY); } + +// test impl_item +// impl Foo {} pub(super) fn impl_item(p: &mut Parser) { assert!(p.at(IMPL_KW)); p.bump(); -- cgit v1.2.3