aboutsummaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2013-08-11 11:25:26 +0800
committerTeddy <ted.sybil@gmail.com>2013-08-11 11:25:26 +0800
commit448ac0bcc3a81e250a825c333dd01c77e754341a (patch)
tree4d8d104fa59bdf73274602dbe2927945abeb92e3 /model.cpp
parent05f893bbe7e8a839c26cc951fafb166c25d0a6ee (diff)
`delay` and `force` support is added
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/model.cpp b/model.cpp
index cf38b13..85d4e04 100644
--- a/model.cpp
+++ b/model.cpp
@@ -55,6 +55,10 @@ bool EvalObj::is_str_obj() {
return otype & CLS_STR_OBJ;
}
+bool EvalObj::is_prom_obj() {
+ return otype & CLS_PROM_OBJ;
+}
+
int EvalObj::get_otype() {
return otype;
}
@@ -385,6 +389,18 @@ VectReprCons::VectReprCons(VecObj *_ptr, EvalObj *_ori) :
}
}
+PromObj::PromObj(EvalObj *exp) :
+ EvalObj(CLS_SIM_OBJ | CLS_PROM_OBJ), entry(new Pair(exp, empty_list)), mem(NULL) {}
+
+Pair *PromObj::get_entry() { return entry; }
+
+ReprCons *PromObj::get_repr_cons() { return new ReprStr("#<Promise>"); }
+
+EvalObj *PromObj::get_mem() { return mem; }
+
+void PromObj::feed_mem(EvalObj *res) { mem = res; }
+
+
bool is_list(Pair *ptr) {
if (ptr == empty_list) return true;
EvalObj *nptr;