commit 8af5c4cbb5442030da5fe9fecd9fdeec9d1bbf76
parent 659779ebc303dd5dd15c784427d874633768c117
Author: Andres Navarro <canavarro82@gmail.com>
Date: Fri, 25 Mar 2011 12:39:33 -0300
Bugfixes in check_list & check_typed_list: replaced & with && (i worked but still...). changed the error text when an improper list was passed and a possibly finite list was expected.
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/kghelpers.c b/src/kghelpers.c
@@ -79,6 +79,9 @@ void ftypep(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
}
}
+/*
+** REFACTOR: Change this to make it a single pass
+*/
void ftyped_predp(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
{
(void) denv;
@@ -116,6 +119,9 @@ void ftyped_predp(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
kapply_cc(K, b2tv(res));
}
+/*
+** REFACTOR: Change this to make it a single pass
+*/
void ftyped_bpredp(klisp_State *K, TValue *xparams, TValue ptree, TValue denv)
{
(void) denv;
@@ -190,9 +196,10 @@ int32_t check_typed_list(klisp_State *K, char *name, char *typename,
unmark_list(K, obj);
if (!ttispair(tail) && !ttisnil(tail)) {
- klispE_throw_extra(K, name , ": expected finite list");
+ klispE_throw_extra(K, name , allow_infp? ": expected list":
+ "expected finite list");
return 0;
- } else if(ttispair(tail) & !allow_infp) {
+ } else if(ttispair(tail) && !allow_infp) {
klispE_throw_extra(K, name , ": expected finite list");
return 0;
} else if (type_errorp) {
@@ -217,9 +224,10 @@ int32_t check_list(klisp_State *K, char *name, bool allow_infp,
unmark_list(K, obj);
if (!ttispair(tail) && !ttisnil(tail)) {
- klispE_throw_extra(K, name , ": expected finite list");
+ klispE_throw_extra(K, name, allow_infp? ": expected list":
+ "expected finite list");
return 0;
- } else if(ttispair(tail) & !allow_infp) {
+ } else if(ttispair(tail) && !allow_infp) {
klispE_throw_extra(K, name , ": expected finite list");
return 0;
} else {