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:
30
src/obj/int.rs
Normal file
30
src/obj/int.rs
Normal 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);
|
||||
Reference in New Issue
Block a user