From 8feb6c68e2058738c4c558fbba2c7d99034f6279 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Tue, 9 Aug 2011 10:32:12 -0700 Subject: [PATCH] kernel: add full stack effects to unless, when, when*, unless* so they give useful stack imbalance errors --- core/kernel/kernel.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/kernel/kernel.factor b/core/kernel/kernel.factor index e506b7fc27..7cf7005350 100644 --- a/core/kernel/kernel.factor +++ b/core/kernel/kernel.factor @@ -32,20 +32,20 @@ DEFER: if : if ( ..a ? true: ( ..a -- ..b ) false: ( ..a -- ..b ) -- ..b ) ? call ; ! Single branch -: unless ( ? false -- ) +: unless ( ..a ? false: ( ..a -- ..a ) -- ..a ) swap [ drop ] [ call ] if ; inline -: when ( ? true -- ) +: when ( ..a ? true: ( ..a -- ..a ) -- ..a ) swap [ call ] [ drop ] if ; inline ! Anaphoric : if* ( ..a ? true: ( ..a ? -- ..b ) false: ( ..a -- ..b ) -- ..b ) pick [ drop call ] [ 2nip call ] if ; inline -: when* ( ? true -- ) +: when* ( ..a ? true: ( ..a ? -- ..a ) -- ..a ) over [ call ] [ 2drop ] if ; inline -: unless* ( ? false -- ) +: unless* ( ..a ? false: ( ..a -- ..a x ) -- ..a x ) over [ drop ] [ nip call ] if ; inline ! Default