Functions are implemented and VM should be able to handle function calls

* VM Signals are used by running functions to dictate whether a function
  should return, or if it should call another function. These signals
  can be injected at any time allowing for user functions to inject
  themselves at runtime.
* obj::Method is gone since it's not being used yet.
* Obj impls must implement as_any(&self) -> &dyn Any now. This allows
  for UserFun and NativeFun to be explicitly cast (among other things,
  in the future).

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-09-24 15:29:44 -07:00
parent f0032afe12
commit 3976b2135a
11 changed files with 236 additions and 71 deletions

View File

@@ -1,4 +1,5 @@
use crate::{obj::prelude::*, vm::consts::*};
use shredder::EmptyScan;
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum Inst {
@@ -19,7 +20,7 @@ pub enum Inst {
/// This will get an attr from the object reference pointed to by the symbol.
GetAttr(Sym),
/// A target reference and a source reference from the stack.
/// Pops a target reference and a source reference from the stack.
///
/// The target reference will have the given symbol attribute assigned to the source.
///
@@ -144,3 +145,5 @@ impl Inst {
}
}
}
impl EmptyScan for Inst { }