Fold runtime/ crate into this source tree

While I like the idea of having a runtime completely decoupled from the
syntax and compiler, I don't think this is that big of a project for
that to be necessary or even useful yet.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2020-09-14 14:14:21 -07:00
parent 8e2cbb10a4
commit 372e58f620
21 changed files with 12 additions and 25 deletions

30
src/obj/int.rs Normal file
View File

@@ -0,0 +1,30 @@
use crate::obj::prelude::*;
use shredder::Scan;
pub type IntRef = ObjRef<Int>;
#[derive(Debug, Scan)]
pub struct Int {
value: i64,
vtable: Vtable,
attrs: Attrs,
}
impl Int {
pub fn new_obj(value: i64) -> ObjRef<Self> {
// TODO : vtable for Int
let obj_ref = ObjRef::new(Self {
value,
vtable: Default::default(),
attrs: Default::default(),
});
obj_ref
}
pub fn value(&self) -> i64 {
self.value
}
}
impl_obj_readonly!(Int);