Interpreter - Store static methods inside classes
This commit is contained in:
parent
ed704b1a63
commit
75652b95cf
2 changed files with 12 additions and 2 deletions
src/interpreter
|
@ -232,7 +232,11 @@ impl StmtNode {
|
|||
ClassMemberDecl::Method(method) => Some(method),
|
||||
_ => None,
|
||||
});
|
||||
let class = Class::new(decl.name.lexeme.clone(), methods);
|
||||
let static_methods = self.extract_methods(es, decl, |member| match member {
|
||||
ClassMemberDecl::StaticMethod(method) => Some(method),
|
||||
_ => None,
|
||||
});
|
||||
let class = Class::new(decl.name.lexeme.clone(), methods, static_methods);
|
||||
es.environment
|
||||
.borrow_mut()
|
||||
.assign(&decl.name, class.into())?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue