Add internal error handling to VM, plus function arity

* VM is able to handle basic runtime errors although there is no way to
  catch this in executing code currently
* If a function is called with the wrong number of arguments (arity) it
  will invoke a runtime error.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-10-13 14:07:22 -07:00
parent c738c52455
commit 902da3f2f3
9 changed files with 98 additions and 50 deletions

View File

@@ -42,7 +42,7 @@ impl Compile {
sym
})
.collect();
Ok((self.const_data.const_pool, UserFun::new_obj(main, globals)))
Ok((self.const_data.const_pool, UserFun::new_obj(main, globals, 0)))
}
/// Gets the constant data that is interned in this compile session.