Include static in class assembly and bytecode

This commit is contained in:
Andrew Morris
2023-06-23 09:47:12 +10:00
parent b3b5887d8b
commit 41a6a20573
5 changed files with 55 additions and 16 deletions

View File

@@ -514,23 +514,30 @@ impl<'a> AssemblyParser<'a> {
}
fn assemble_class(&mut self) -> Class {
self.parse_exact("class(");
self.parse_exact("class {");
self.parse_optional_whitespace();
self.parse_exact("constructor: ");
let constructor = self.assemble_value();
self.parse_optional_whitespace();
self.parse_exact(",");
self.parse_optional_whitespace();
let methods = self.assemble_value();
self.parse_exact("prototype: ");
let prototype = self.assemble_value();
self.parse_exact(",");
self.parse_optional_whitespace();
self.parse_exact(")");
self.parse_exact("static: ");
let static_ = self.assemble_value();
self.parse_exact(",");
self.parse_optional_whitespace();
self.parse_exact("}");
Class {
constructor,
prototype: methods,
prototype,
static_,
}
}