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