lisette-semantics 0.2.13

Little language inspired by Rust that compiles to Go
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use diagnostics::LisetteDiagnostic;
use syntax::ast::Expression;

pub fn check_empty_match_arm(expression: &Expression, diagnostics: &mut Vec<LisetteDiagnostic>) {
    let Expression::Match { arms, .. } = expression else {
        return;
    };

    for arm in arms {
        if let Expression::Block { items, span, .. } = &*arm.expression
            && items.is_empty()
        {
            diagnostics.push(diagnostics::lint::empty_match_arm(span));
        }
    }
}