From fbb958da829d40b43c1d0ff3b0ed616f07b43703 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 5 Nov 2008 18:59:58 -0600 Subject: [PATCH] Fix lambda-method forget --- basis/locals/locals-tests.factor | 9 ++++++++- basis/locals/locals.factor | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/basis/locals/locals-tests.factor b/basis/locals/locals-tests.factor index c449c26348..003ef459e3 100644 --- a/basis/locals/locals-tests.factor +++ b/basis/locals/locals-tests.factor @@ -1,7 +1,8 @@ USING: locals math sequences tools.test hashtables words kernel namespaces arrays strings prettyprint io.streams.string parser accessors generic eval combinators combinators.short-circuit -combinators.short-circuit.smart math.order math.functions ; +combinators.short-circuit.smart math.order math.functions +definitions compiler.units ; IN: locals.tests :: foo ( a b -- a a ) a a ; @@ -378,6 +379,12 @@ M:: sequence method-with-locals ( a -- y ) a reverse ; [ 9 ] [ 3 big-case-test ] unit-test +GENERIC: lambda-method-forget-test ( a -- b ) + +M:: integer lambda-method-forget-test ( a -- b ) ; + +[ ] [ [ { integer lambda-method-forget-test } forget ] with-compilation-unit ] unit-test + ! :: wlet-&&-test ( a -- ? ) ! [wlet | is-integer? [ a integer? ] ! is-even? [ a even? ] diff --git a/basis/locals/locals.factor b/basis/locals/locals.factor index 89a5c02746..c588269284 100644 --- a/basis/locals/locals.factor +++ b/basis/locals/locals.factor @@ -450,7 +450,7 @@ M: lambda-method definition "lambda" word-prop body>> ; M: lambda-method reset-word - [ f "lambda" set-word-prop ] [ call-next-method ] bi ; + [ call-next-method ] [ f "lambda" set-word-prop ] bi ; INTERSECTION: lambda-memoized memoized lambda-word ;