locals.parser: don't clone the manifest, just pop used words.
It seems the manifest gets cloned on restarts, which makes unuse-words not work since it just checks ``eq?``. If we pop the last qualified vocabs, then everything works.db4
parent
529a57bbb4
commit
507dac7599
|
@ -59,17 +59,6 @@ IN: locals.parser.tests
|
|||
] unit-test
|
||||
|
||||
<<
|
||||
! with-lambda-scope
|
||||
{ t } [
|
||||
[
|
||||
qualified-vocabs length
|
||||
H{ } clone [
|
||||
"hey there!" qualified-vocabs push [ ]
|
||||
] with-lambda-scope drop
|
||||
qualified-vocabs length =
|
||||
] with-compilation-unit
|
||||
] unit-test
|
||||
|
||||
{
|
||||
"V{ 99 :> kkk kkk }"
|
||||
} [
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays assocs assocs.private combinators
|
||||
USING: accessors arrays assocs combinators continuations
|
||||
effects.parser fry generic.parser kernel lexer locals.errors
|
||||
locals.rewrite.closures locals.types make math namespaces
|
||||
namespaces.private parser quotations sequences splitting
|
||||
vocabs.parser words ;
|
||||
locals.rewrite.closures locals.types make namespaces parser
|
||||
quotations sequences splitting vocabs.parser words ;
|
||||
IN: locals.parser
|
||||
|
||||
SYMBOL: in-lambda?
|
||||
|
@ -32,24 +31,13 @@ ERROR: invalid-local-name name ;
|
|||
|
||||
SINGLETON: lambda-parser
|
||||
|
||||
: prev-manifest ( -- manifest )
|
||||
manifest namestack* [ length 2 - ] keep (assoc-stack) ;
|
||||
|
||||
: update-manifest ( manifest -- )
|
||||
[ prev-manifest ] dip {
|
||||
[ search-vocab-names>> >>search-vocab-names ]
|
||||
[ search-vocabs>> >>search-vocabs ]
|
||||
[ auto-used>> >>auto-used ]
|
||||
} cleave drop ;
|
||||
|
||||
: with-lambda-scope ( assoc reader-quot: ( -- quot ) -- quot )
|
||||
'[
|
||||
in-lambda? on
|
||||
lambda-parser quotation-parser set
|
||||
manifest [ clone ] change
|
||||
use-words @
|
||||
manifest get
|
||||
] with-scope update-manifest ; inline
|
||||
qualified-vocabs pop* ! can't use unuse-words here
|
||||
] with-scope ; inline
|
||||
|
||||
: (parse-lambda) ( assoc -- quot )
|
||||
[ \ ] parse-until >quotation ] with-lambda-scope ;
|
||||
|
|
Loading…
Reference in New Issue