Initial commit
Includes: runtime base from a previous project, syn(tax) module with parser and lexer Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
30
runtime/src/obj/int.rs
Normal file
30
runtime/src/obj/int.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use crate::obj::{names::*, prelude::*};
|
||||
use shredder::Scan;
|
||||
|
||||
#[derive(Debug, Scan)]
|
||||
pub struct Int {
|
||||
value: i64,
|
||||
attrs: Attrs,
|
||||
}
|
||||
|
||||
impl Int {
|
||||
pub fn new(value: i64) -> ObjRef<Self> {
|
||||
let obj_ref = ObjRef::new(Self {
|
||||
value,
|
||||
attrs: Default::default(),
|
||||
});
|
||||
|
||||
{
|
||||
write_obj!(let obj = obj_ref);
|
||||
obj.set_attr(*GET_ATTR_MEMBER_SYM, GET_ATTR_MEMBER_FUN.clone());
|
||||
}
|
||||
|
||||
obj_ref
|
||||
}
|
||||
|
||||
pub fn value(&self) -> i64 {
|
||||
self.value
|
||||
}
|
||||
}
|
||||
|
||||
impl_obj!(Int, attrs);
|
||||
Reference in New Issue
Block a user