[fine] Oh no a runtime and module loading and stuff

Lots of test work to use the new mechanism. I'm not sure I like it.
This commit is contained in:
John Doty 2024-02-12 22:49:34 -08:00
parent 2093502031
commit 994268abb6
6 changed files with 224 additions and 90 deletions

View file

@ -237,7 +237,7 @@ macro_rules! inst_panic {
// ($compiler:expr, $tr:expr, $($t:tt)*) => {{}};
// }
pub fn compile(semantics: Rc<Semantics>) -> Rc<Module> {
pub fn compile(semantics: &Semantics) -> Rc<Module> {
let source = semantics.source();
let syntax_tree = semantics.tree();
@ -998,6 +998,8 @@ fn compile_list_constructor_element(c: &mut Compiler, tree: &Tree) -> CR {
fn compile_statement(c: &mut Compiler, t: TreeRef, gen_value: bool) {
let tree = &c.semantics.tree()[t];
let cr = match tree.kind {
TreeKind::Error => None,
TreeKind::Block => compile_block_statement(c, t, gen_value),
TreeKind::ClassDecl => compile_class_declaration(c, t, tree, gen_value),
TreeKind::ExpressionStatement => compile_expression_statement(c, tree, gen_value),