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
John Benediktsson 2015-07-20 17:33:33 -07:00
parent 529a57bbb4
commit 507dac7599
2 changed files with 5 additions and 28 deletions

View File

@ -59,17 +59,6 @@ IN: locals.parser.tests
] unit-test ] 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 }" "V{ 99 :> kkk kkk }"
} [ } [

View File

@ -1,10 +1,9 @@
! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos. ! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos.
! See http://factorcode.org/license.txt for BSD license. ! 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 effects.parser fry generic.parser kernel lexer locals.errors
locals.rewrite.closures locals.types make math namespaces locals.rewrite.closures locals.types make namespaces parser
namespaces.private parser quotations sequences splitting quotations sequences splitting vocabs.parser words ;
vocabs.parser words ;
IN: locals.parser IN: locals.parser
SYMBOL: in-lambda? SYMBOL: in-lambda?
@ -32,24 +31,13 @@ ERROR: invalid-local-name name ;
SINGLETON: lambda-parser 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 ) : with-lambda-scope ( assoc reader-quot: ( -- quot ) -- quot )
'[ '[
in-lambda? on in-lambda? on
lambda-parser quotation-parser set lambda-parser quotation-parser set
manifest [ clone ] change
use-words @ use-words @
manifest get qualified-vocabs pop* ! can't use unuse-words here
] with-scope update-manifest ; inline ] with-scope ; inline
: (parse-lambda) ( assoc -- quot ) : (parse-lambda) ( assoc -- quot )
[ \ ] parse-until >quotation ] with-lambda-scope ; [ \ ] parse-until >quotation ] with-lambda-scope ;