]> gitweb.factorcode.org Git - factor.git/commitdiff
functors: don't leak the bindings.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 15 Mar 2016 23:12:37 +0000 (16:12 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 15 Mar 2016 23:12:37 +0000 (16:12 -0700)
basis/functors/functors.factor

index d6233dadcc6f46065215e08ff2e12338c7a807d3..95b0f9057af32febe243d8f88a1712d89699104d 100644 (file)
@@ -6,6 +6,7 @@ effects.parser fry functors.backend generic generic.parser
 interpolate io.streams.string kernel lexer locals.parser
 locals.types macros make namespaces parser quotations sequences
 vocabs.parser words words.symbol ;
+
 IN: functors
 
 ! This is a hack
@@ -147,15 +148,12 @@ DEFER: ;FUNCTOR delimiter
         [ nip scan-object 2array ]
     } cond ;
 
-: (parse-bindings) ( end -- words )
-    [ dup parse-binding dup ]
-    [ first2 [ make-local ] dip 2array ]
-    produce 2nip ;
-
 : parse-bindings ( end -- words assoc )
-    [
+    '[
         building get use-words
-        (parse-bindings)
+        [ _ parse-binding dup ]
+        [ first2 [ make-local ] dip 2array ]
+        produce nip
     ] H{ } make ;
 
 : parse-functor-body ( -- form )
@@ -163,6 +161,7 @@ DEFER: ;FUNCTOR delimiter
         "WHERE" parse-bindings drop
         [ swap <def> suffix ] { } assoc>map concat
         \ ;FUNCTOR parse-until [ ] append-as
+        qualified-vocabs pop* ! unuse the bindings
     ] with-lambda-scope ;
 
 : (FUNCTOR:) ( -- word def effect )