From 2fa90e736b026ee979d9eb59178dc1f792228250 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 11:12:42 +0300 Subject: better recovery for exprs --- crates/libsyntax2/src/ast/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/libsyntax2/src/ast/mod.rs') diff --git a/crates/libsyntax2/src/ast/mod.rs b/crates/libsyntax2/src/ast/mod.rs index 2ebee6a4f..9941138a7 100644 --- a/crates/libsyntax2/src/ast/mod.rs +++ b/crates/libsyntax2/src/ast/mod.rs @@ -115,6 +115,15 @@ impl<'a> Module<'a> { } } +impl<'a> LetStmt<'a> { + pub fn has_semi(self) -> bool { + match self.syntax().last_child() { + None => false, + Some(node) => node.kind() == SEMI, + } + } +} + impl<'a> IfExpr<'a> { pub fn then_branch(self) -> Option> { self.blocks().nth(0) -- cgit v1.2.3