]> gitweb.factorcode.org Git - factor.git/commitdiff
locals.parser: fix bug where auto-use restarts weren't working properly.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 20 Jul 2015 02:17:46 +0000 (19:17 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 20 Jul 2015 02:18:47 +0000 (19:18 -0700)
basis/locals/parser/parser.factor

index 3f318a7cf94a167beb714d1213503332d992439c..fdc588ca7c6a224f956fe855419e7fd9a7c4eee6 100644 (file)
@@ -1,9 +1,10 @@
 ! Copyright (C) 2007, 2009 Slava Pestov, Eduardo Cavazos.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs combinators effects.parser
-generic.parser kernel lexer locals.errors fry
-locals.rewrite.closures locals.types make namespaces parser
-quotations sequences splitting words vocabs.parser ;
+USING: accessors arrays assocs assocs.private combinators
+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 ;
 IN: locals.parser
 
 SYMBOL: in-lambda?
@@ -31,13 +32,24 @@ 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 @
-    ] with-scope ; inline
+        manifest get
+    ] with-scope update-manifest ; inline
 
 : (parse-lambda) ( assoc -- quot )
     [ \ ] parse-until >quotation ] with-lambda-scope ;