[fine] Imports maybe
Feels a little sketchy
This commit is contained in:
parent
1199646e29
commit
60e8f64c01
4 changed files with 299 additions and 85 deletions
|
|
@ -582,7 +582,8 @@ fn compile_binary_expression(c: &mut Compiler, t: TreeRef, tr: &Tree) -> CR {
|
|||
Declaration::ExternFunction { .. } => inst_panic!("store ext"),
|
||||
Declaration::Function { .. } => inst_panic!("store func"),
|
||||
Declaration::Class { .. } => inst_panic!("store class"),
|
||||
Declaration::Import { .. } => inst_panic!("store import"),
|
||||
Declaration::ImportedModule { .. } => inst_panic!("store import"),
|
||||
Declaration::ImportedDeclaration { .. } => inst_panic!("store import decl"),
|
||||
};
|
||||
c.push(instruction);
|
||||
OK
|
||||
|
|
@ -662,7 +663,8 @@ fn compile_load_declaration(c: &mut Compiler, t: TreeRef, declaration: &Declarat
|
|||
Declaration::Class { .. } => return OK,
|
||||
|
||||
// fix later
|
||||
Declaration::Import { .. } => ice!(c, t, "import compile not supported"),
|
||||
Declaration::ImportedModule { .. } => ice!(c, t, "import compile not supported"),
|
||||
Declaration::ImportedDeclaration { .. } => ice!(c, t, "import decl not supported"),
|
||||
};
|
||||
|
||||
c.push(instruction);
|
||||
|
|
@ -874,11 +876,12 @@ fn compile_argument(c: &mut Compiler, tree: &Tree) -> CR {
|
|||
|
||||
fn compile_new_object_expression(c: &mut Compiler, t: TreeRef, tree: &Tree) -> CR {
|
||||
// We pass in the arguments.... by... field order?
|
||||
let Type::Object(ct, _) = c.semantics.type_of(t) else {
|
||||
let Type::Object(mid, ct, _) = c.semantics.type_of(t) else {
|
||||
c.push(inst_panic!("new obj not ob"));
|
||||
return OK;
|
||||
};
|
||||
let class = c.semantics.class_of(ct);
|
||||
|
||||
let class = c.semantics.class_of(mid, ct);
|
||||
|
||||
let field_list = tree.child_tree_of_kind(&c.syntax, TreeKind::FieldList)?;
|
||||
let mut field_bindings = HashMap::new();
|
||||
|
|
@ -951,12 +954,12 @@ fn compile_member_access(c: &mut Compiler, t: TreeRef, tree: &Tree) -> CR {
|
|||
let ident = tree.nth_token(2)?.as_str(&c.source);
|
||||
|
||||
let environment = match &typ {
|
||||
Type::Object(ct, _) => {
|
||||
let class = c.semantics.class_of(*ct);
|
||||
Type::Object(mid, ct, _) => {
|
||||
let class = c.semantics.class_of(*mid, *ct);
|
||||
class.env.clone()
|
||||
}
|
||||
Type::Class(ct, _) => {
|
||||
let class = c.semantics.class_of(*ct);
|
||||
Type::Class(mid, ct, _) => {
|
||||
let class = c.semantics.class_of(*mid, *ct);
|
||||
class.static_env.clone()
|
||||
}
|
||||
_ => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue