Introduce EffectExpr

This commit is contained in:
Aleksey Kladov 2020-05-02 01:18:19 +02:00
parent 3c96de5380
commit 4f2134cc33
25 changed files with 242 additions and 261 deletions

View file

@ -6,19 +6,17 @@ use crate::{
SyntaxKind::*,
};
pub(crate) fn validate_block_expr(expr: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
if let Some(parent) = expr.syntax().parent() {
pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) {
if let Some(parent) = block.syntax().parent() {
match parent.kind() {
FN_DEF | EXPR_STMT | BLOCK => return,
FN_DEF | EXPR_STMT | BLOCK_EXPR => return,
_ => {}
}
}
if let Some(block) = expr.block() {
errors.extend(block.attrs().map(|attr| {
SyntaxError::new(
"A block in this position cannot accept inner attributes",
attr.syntax().text_range(),
)
}))
}
errors.extend(block.attrs().map(|attr| {
SyntaxError::new(
"A block in this position cannot accept inner attributes",
attr.syntax().text_range(),
)
}))
}