Add function compilation

Functions are compiled in the most naiive way right now. I want to fix
up how scope lookups are done before it becomes too much to update.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-09-26 18:31:23 -07:00
parent 3976b2135a
commit 4848a342f0
7 changed files with 53 additions and 21 deletions

View File

@@ -18,11 +18,11 @@ pub struct UserFun {
code: Vec<Inst>,
// Safe because this is just an interner that points to symbols, which aren't GC'd
#[shredder(unsafe_skip)]
locals: Names,
locals: Locals,
}
impl UserFun {
pub fn new_obj(code: Vec<Inst>, locals: Names) -> UserFunRef {
pub fn new_obj(code: Vec<Inst>, locals: Locals) -> UserFunRef {
let obj_ref = ObjRef::new(UserFun {
vtable: Default::default(), // this is a placeholder for the real vtable
attrs: Default::default(),
@@ -47,7 +47,7 @@ impl UserFun {
&self.code
}
pub fn locals(&self) -> &Names {
pub fn locals(&self) -> &Locals {
&self.locals
}
}