[fine] Re-work compiler main, checking is everything
This commit is contained in:
parent
5c05077312
commit
d8db65af55
3 changed files with 67 additions and 30 deletions
|
|
@ -841,6 +841,44 @@ impl<'a> Semantics<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn check(s: &Semantics) {
|
||||
for t in s.syntax_tree.trees() {
|
||||
let tree = &s.syntax_tree[t];
|
||||
match tree.kind {
|
||||
TreeKind::Error => {} // already reported
|
||||
TreeKind::File => {}
|
||||
TreeKind::FunctionDecl => {
|
||||
let _ = s.environment_of(t);
|
||||
}
|
||||
TreeKind::ParamList => {}
|
||||
TreeKind::Parameter => {}
|
||||
TreeKind::TypeExpression => {
|
||||
let _ = s.type_of_type_expr(tree);
|
||||
}
|
||||
TreeKind::Block => {
|
||||
let _ = s.type_of_block(tree);
|
||||
}
|
||||
TreeKind::LetStatement => {
|
||||
let _ = s.environment_of(t);
|
||||
}
|
||||
TreeKind::ReturnStatement => {}
|
||||
TreeKind::ExpressionStatement
|
||||
| TreeKind::LiteralExpression
|
||||
| TreeKind::GroupingExpression
|
||||
| TreeKind::UnaryExpression
|
||||
| TreeKind::ConditionalExpression
|
||||
| TreeKind::CallExpression
|
||||
| TreeKind::BinaryExpression => {
|
||||
let _ = s.type_of(t);
|
||||
}
|
||||
TreeKind::ArgumentList => {}
|
||||
TreeKind::Argument => {}
|
||||
TreeKind::IfStatement => {}
|
||||
TreeKind::Identifier => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue