aboutsummaryrefslogtreecommitdiff
path: root/model.cpp
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-09 12:41:49 +0800
committerTeddy <[email protected]>2013-08-09 12:41:49 +0800
commit01b2c905872ff38d5d8291f2f8de92c2771f183f (patch)
treebd3622d29d29cc1f7205a79eca9a15ee377c719a /model.cpp
parent0c606491335e99017897a7710461214412243dd7 (diff)
removed `skip` field from Pair, use `next` to make jumps insteadskip_removal
Diffstat (limited to 'model.cpp')
-rw-r--r--model.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/model.cpp b/model.cpp
index 6c5e4a0..f5ed609 100644
--- a/model.cpp
+++ b/model.cpp
@@ -89,9 +89,13 @@ string EvalObj::ext_repr() {
{
top_ptr--;
obj = (*top_ptr)->next("");
- *(++top_ptr) = obj->get_repr_cons();
- if (hash.count((*top_ptr)->ori))
- *top_ptr = new ReprStr("#inf#");
+ if (obj)
+ {
+ *(++top_ptr) = obj->get_repr_cons();
+ if (hash.count((*top_ptr)->ori))
+ *top_ptr = new ReprStr("#inf#");
+ }
+ else *top_ptr = new ReprStr((*top_ptr)->repr);
}
top_ptr++;
}
@@ -102,7 +106,7 @@ string EvalObj::ext_repr() {
}
Pair::Pair(EvalObj *_car, EvalObj *_cdr) :
- EvalObj(CLS_PAIR_OBJ), car(_car), cdr(_cdr), skip(false),
+ EvalObj(CLS_PAIR_OBJ), car(_car), cdr(_cdr),
next(NULL) {}
ReprCons *Pair::get_repr_cons() {