locals.parser: fix for #1340, write locals directly to the manifest
The locals parser used to parse and store locals in the 'locals' variable which was an alias to 'manifest get qualified-vocabs>> last words>>'. For some reason, after a restart they become distinct objects. An easy fix is to not alias the hash in the first place.db4
parent
8ef135bc2f
commit
92868fe778
basis/locals
|
@ -6,8 +6,8 @@ locals.errors ;
|
|||
IN: locals
|
||||
|
||||
SYNTAX: :>
|
||||
scan-token locals get [ :>-outside-lambda-error ] unless*
|
||||
parse-def suffix! ;
|
||||
in-lambda? get [ :>-outside-lambda-error ] unless
|
||||
scan-token parse-def suffix! ;
|
||||
|
||||
SYNTAX: [| parse-lambda append! ;
|
||||
|
||||
|
|
|
@ -31,15 +31,11 @@ ERROR: invalid-local-name name ;
|
|||
|
||||
SINGLETON: lambda-parser
|
||||
|
||||
SYMBOL: locals
|
||||
|
||||
: ((parse-lambda)) ( assoc reader-quot -- quot )
|
||||
: ((parse-lambda)) ( assoc reader-quot: ( -- quot ) -- quot )
|
||||
'[
|
||||
in-lambda? on
|
||||
lambda-parser quotation-parser set
|
||||
[ locals set ]
|
||||
[ use-words @ ]
|
||||
[ unuse-words ] tri
|
||||
[ use-words @ ] [ unuse-words ] bi
|
||||
] with-scope ; inline
|
||||
|
||||
: (parse-lambda) ( assoc -- quot )
|
||||
|
@ -50,14 +46,17 @@ SYMBOL: locals
|
|||
(parse-lambda) <lambda>
|
||||
?rewrite-closures ;
|
||||
|
||||
: parse-multi-def ( locals -- multi-def )
|
||||
")" parse-tokens make-locals swapd assoc-union! drop <multi-def> ;
|
||||
: parse-multi-def ( -- multi-def assoc )
|
||||
")" parse-tokens make-locals [ <multi-def> ] dip ;
|
||||
|
||||
: parse-single-def ( name locals -- def )
|
||||
swap [ make-local ] H{ } make swapd assoc-union! drop <def> ;
|
||||
: parse-single-def ( name -- def assoc )
|
||||
[ make-local <def> ] H{ } make ;
|
||||
|
||||
: parse-def ( name/paren locals -- def )
|
||||
over "(" = [ nip parse-multi-def ] [ parse-single-def ] if ;
|
||||
: update-locals ( assoc -- )
|
||||
manifest get qualified-vocabs>> last words>> swap assoc-union! drop ;
|
||||
|
||||
: parse-def ( name/paren -- def )
|
||||
dup "(" = [ drop parse-multi-def ] [ parse-single-def ] if update-locals ;
|
||||
|
||||
M: lambda-parser parse-quotation ( -- quotation )
|
||||
H{ } clone (parse-lambda) ;
|
||||
|
|
Loading…
Reference in New Issue