From f1bacc2110e1f8d64d5e59ecccc941e76b91d1d4 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 5 Apr 2008 22:59:31 -0500 Subject: [PATCH] Smarter breakpoint word --- extra/tools/annotations/annotations.factor | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/extra/tools/annotations/annotations.factor b/extra/tools/annotations/annotations.factor index 07038ceadf..ef710ea57d 100755 --- a/extra/tools/annotations/annotations.factor +++ b/extra/tools/annotations/annotations.factor @@ -2,10 +2,16 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel words parser io inspector quotations sequences prettyprint continuations effects definitions compiler.units -namespaces assocs tools.walker ; +namespaces assocs tools.walker generic ; IN: tools.annotations -: reset ( word -- ) +GENERIC: reset ( word -- ) + +M: generic reset + [ call-next-method ] + [ subwords [ reset ] each ] bi ; + +M: word reset dup "unannotated-def" word-prop [ [ dup dup "unannotated-def" word-prop define @@ -60,8 +66,16 @@ IN: tools.annotations : watch-vars ( word vars -- ) dupd [ (watch-vars) ] 2curry annotate ; +GENERIC# annotate-methods 1 ( word quot -- ) + +M: generic annotate-methods + >r "methods" word-prop values r> [ annotate ] curry each ; + +M: word annotate-methods + annotate ; + : breakpoint ( word -- ) - [ add-breakpoint ] annotate ; + [ add-breakpoint ] annotate-methods ; : breakpoint-if ( word quot -- ) - [ [ [ break ] when ] rot 3append ] curry annotate ; + [ [ [ break ] when ] rot 3append ] curry annotate-methods ;