From afdd53768194272b267591e5a3a2d97075d1bd34 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 13 Jul 2009 23:35:21 -0500 Subject: [PATCH] tools.annotations: add (annotate) word which doesn't create a compilation unit for use in loops --- basis/tools/annotations/annotations.factor | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/basis/tools/annotations/annotations.factor b/basis/tools/annotations/annotations.factor index e7e5837ee8..f02476d4da 100644 --- a/basis/tools/annotations/annotations.factor +++ b/basis/tools/annotations/annotations.factor @@ -31,19 +31,20 @@ M: cannot-annotate-twice summary drop "Cannot annotate a word twice" ; cannot-annotate-twice ] when ; +GENERIC# (annotate) 1 ( word quot -- ) + +M: generic (annotate) + [ "methods" word-prop values ] dip '[ _ (annotate) ] each ; + +M: word (annotate) + [ check-annotate-twice ] dip + [ dup def>> 2dup "unannotated-def" set-word-prop ] dip + call( old -- new ) define ; + PRIVATE> -GENERIC# annotate 1 ( word quot -- ) - -M: generic annotate - [ "methods" word-prop values ] dip '[ _ annotate ] each ; - -M: word annotate - [ check-annotate-twice ] dip - [ - [ dup def>> 2dup "unannotated-def" set-word-prop ] dip - call( old -- new ) define - ] with-compilation-unit ; +: annotate ( word quot -- ) + [ (annotate) ] with-compilation-unit ;