Resolver - Class declarations
This commit is contained in:
parent
5702abe44d
commit
9bfb549a22
1 changed files with 7 additions and 0 deletions
|
@ -37,6 +37,7 @@ enum SymState {
|
||||||
enum SymKind {
|
enum SymKind {
|
||||||
Variable,
|
Variable,
|
||||||
Function,
|
Function,
|
||||||
|
Class,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// General information about a symbol.
|
/// General information about a symbol.
|
||||||
|
@ -261,6 +262,12 @@ impl VarResolver for StmtNode {
|
||||||
rs.with_scope(|rs| resolve_function(rs, &decl.params, &decl.body))
|
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 {
|
StmtNode::If {
|
||||||
condition,
|
condition,
|
||||||
then_branch,
|
then_branch,
|
||||||
|
|
Loading…
Reference in a new issue