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
|
@ -6,8 +6,8 @@ locals.errors ;
|
||||||
IN: locals
|
IN: locals
|
||||||
|
|
||||||
SYNTAX: :>
|
SYNTAX: :>
|
||||||
scan-token locals get [ :>-outside-lambda-error ] unless*
|
in-lambda? get [ :>-outside-lambda-error ] unless
|
||||||
parse-def suffix! ;
|
scan-token parse-def suffix! ;
|
||||||
|
|
||||||
SYNTAX: [| parse-lambda append! ;
|
SYNTAX: [| parse-lambda append! ;
|
||||||
|
|
||||||
|
|
|
@ -31,15 +31,11 @@ ERROR: invalid-local-name name ;
|
||||||
|
|
||||||
SINGLETON: lambda-parser
|
SINGLETON: lambda-parser
|
||||||
|
|
||||||
SYMBOL: locals
|
: ((parse-lambda)) ( assoc reader-quot: ( -- quot ) -- quot )
|
||||||
|
|
||||||
: ((parse-lambda)) ( assoc reader-quot -- quot )
|
|
||||||
'[
|
'[
|
||||||
in-lambda? on
|
in-lambda? on
|
||||||
lambda-parser quotation-parser set
|
lambda-parser quotation-parser set
|
||||||
[ locals set ]
|
[ use-words @ ] [ unuse-words ] bi
|
||||||
[ use-words @ ]
|
|
||||||
[ unuse-words ] tri
|
|
||||||
] with-scope ; inline
|
] with-scope ; inline
|
||||||
|
|
||||||
: (parse-lambda) ( assoc -- quot )
|
: (parse-lambda) ( assoc -- quot )
|
||||||
|
@ -50,14 +46,17 @@ SYMBOL: locals
|
||||||
(parse-lambda) <lambda>
|
(parse-lambda) <lambda>
|
||||||
?rewrite-closures ;
|
?rewrite-closures ;
|
||||||
|
|
||||||
: parse-multi-def ( locals -- multi-def )
|
: parse-multi-def ( -- multi-def assoc )
|
||||||
")" parse-tokens make-locals swapd assoc-union! drop <multi-def> ;
|
")" parse-tokens make-locals [ <multi-def> ] dip ;
|
||||||
|
|
||||||
: parse-single-def ( name locals -- def )
|
: parse-single-def ( name -- def assoc )
|
||||||
swap [ make-local ] H{ } make swapd assoc-union! drop <def> ;
|
[ make-local <def> ] H{ } make ;
|
||||||
|
|
||||||
: parse-def ( name/paren locals -- def )
|
: update-locals ( assoc -- )
|
||||||
over "(" = [ nip parse-multi-def ] [ parse-single-def ] if ;
|
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 )
|
M: lambda-parser parse-quotation ( -- quotation )
|
||||||
H{ } clone (parse-lambda) ;
|
H{ } clone (parse-lambda) ;
|
||||||
|
|
Loading…
Reference in New Issue