From c5f2c8fa951100d6c3ee13e551c4ec78b7a4a616 Mon Sep 17 00:00:00 2001 From: Teddy Date: Wed, 7 Aug 2013 16:15:17 +0800 Subject: more than three arguments aren't allowed in `if` --- builtin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'builtin.cpp') diff --git a/builtin.cpp b/builtin.cpp index 2c951b6..0228b45 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -537,7 +537,7 @@ SpecialOptIf::SpecialOptIf() : SpecialOptObj("if") {} void SpecialOptIf::prepare(Cons *pc) { #define IF_EXP_ERR \ - throw TokenError("if", RUN_ERR_WRONG_NUM_OF_ARGS) + throw TokenError(name, RUN_ERR_WRONG_NUM_OF_ARGS) state = 0; // Prepared if (pc->cdr->is_cons_obj()) @@ -560,7 +560,11 @@ void SpecialOptIf::prepare(Cons *pc) { if (pc->cdr != empty_list) { if (pc->cdr->is_cons_obj()) + { TO_CONS(pc->cdr)->skip = true; + if (TO_CONS(pc->cdr)->cdr != empty_list) + IF_EXP_ERR; + } else IF_EXP_ERR; } -- cgit v1.2.3