Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/expr_ext.rs')
-rw-r--r--crates/syntax/src/ast/expr_ext.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/syntax/src/ast/expr_ext.rs b/crates/syntax/src/ast/expr_ext.rs
index c43d0830b9..36980b146e 100644
--- a/crates/syntax/src/ast/expr_ext.rs
+++ b/crates/syntax/src/ast/expr_ext.rs
@@ -288,6 +288,7 @@ impl ast::ArrayExpr {
pub enum LiteralKind {
String(ast::String),
ByteString(ast::ByteString),
+ CString(ast::CString),
IntNumber(ast::IntNumber),
FloatNumber(ast::FloatNumber),
Char(ast::Char),
@@ -319,6 +320,9 @@ impl ast::Literal {
if let Some(t) = ast::ByteString::cast(token.clone()) {
return LiteralKind::ByteString(t);
}
+ if let Some(t) = ast::CString::cast(token.clone()) {
+ return LiteralKind::CString(t);
+ }
if let Some(t) = ast::Char::cast(token.clone()) {
return LiteralKind::Char(t);
}
@@ -366,8 +370,7 @@ impl ast::BlockExpr {
match parent.kind() {
FOR_EXPR | IF_EXPR => parent
.children()
- .filter(|it| ast::Expr::can_cast(it.kind()))
- .next()
+ .find(|it| ast::Expr::can_cast(it.kind()))
.map_or(true, |it| it == *self.syntax()),
LET_ELSE | FN | WHILE_EXPR | LOOP_EXPR | CONST_BLOCK_PAT => false,
_ => true,