lisette-semantics 0.2.16

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
17
18
use diagnostics::LocalSink;
use syntax::ast::{Expression, Literal};

const FILE_MODE_ID: &str = "go:io/fs.FileMode";
const PERM_MASK: u64 = 0o777;

pub(crate) fn check(expression: &Expression, sink: &LocalSink) {
    if let Expression::Literal {
        literal: Literal::Integer { value, text: None },
        ty,
        span,
    } = expression
        && *value > PERM_MASK
        && ty.get_qualified_id() == Some(FILE_MODE_ID)
    {
        sink.push(diagnostics::infer::decimal_file_mode(span, *value));
    }
}