functors: don't leak the bindings.

locals-and-roots
John Benediktsson 2016-03-15 16:12:37 -07:00
parent 07c867846a
commit ee599e9dea
1 changed files with 6 additions and 7 deletions

View 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 )