Resolver - Class declarations

This commit is contained in:
Emmanuel BENOîT 2023-01-07 14:07:59 +01:00
parent 5702abe44d
commit 9bfb549a22

View file

@ -37,6 +37,7 @@ enum SymState {
enum SymKind {
Variable,
Function,
Class,
}
/// General information about a symbol.
@ -261,6 +262,12 @@ impl VarResolver for StmtNode {
rs.with_scope(|rs| resolve_function(rs, &decl.params, &decl.body))
}
StmtNode::ClassDecl(decl) => {
rs.declare(&decl.name, SymKind::Class)?;
rs.define(&decl.name);
Ok(())
}
StmtNode::If {
condition,
then_branch,