ABOUT: updates vocabulary

db4
Slava Pestov 2008-04-05 07:00:09 -05:00
parent 1d3205c69e
commit f7f43fa689
6 changed files with 20 additions and 17 deletions

View File

@ -30,7 +30,7 @@ crossref off
! Bring up a bare cross-compiling vocabulary. ! Bring up a bare cross-compiling vocabulary.
"syntax" vocab vocab-words bootstrap-syntax set "syntax" vocab vocab-words bootstrap-syntax set
H{ } clone dictionary set H{ } clone dictionary set
H{ } clone changed-words set H{ } clone changed-definitions set
H{ } clone forgotten-definitions set H{ } clone forgotten-definitions set
H{ } clone root-cache set H{ } clone root-cache set
H{ } clone source-files set H{ } clone source-files set

View File

@ -174,7 +174,7 @@ M: tuple-class update-class
2drop 2drop
[ [
[ update-tuples-after ] [ update-tuples-after ]
[ changed-word ] [ changed-definition ]
[ redefined ] [ redefined ]
tri tri
] each-subclass ] each-subclass

View File

@ -56,12 +56,12 @@ GENERIC: definitions-changed ( assoc obj -- )
[ drop word? ] assoc-subset [ drop word? ] assoc-subset
[ drop word-vocabulary dup [ vocab ] when dup ] assoc-map ; [ drop word-vocabulary dup [ vocab ] when dup ] assoc-map ;
: changed-definitions ( -- assoc ) : updated-definitions ( -- assoc )
H{ } clone H{ } clone
dup forgotten-definitions get update dup forgotten-definitions get update
dup new-definitions get first update dup new-definitions get first update
dup new-definitions get second update dup new-definitions get second update
dup changed-words get update dup changed-definitions get update
dup dup changed-vocabs update ; dup dup changed-vocabs update ;
: compile ( words -- ) : compile ( words -- )
@ -73,7 +73,7 @@ SYMBOL: outdated-tuples
SYMBOL: update-tuples-hook SYMBOL: update-tuples-hook
: call-recompile-hook ( -- ) : call-recompile-hook ( -- )
changed-words get keys changed-definitions get keys [ word? ] subset
compiled-usages recompile-hook get call ; compiled-usages recompile-hook get call ;
: call-update-tuples-hook ( -- ) : call-update-tuples-hook ( -- )
@ -83,11 +83,11 @@ SYMBOL: update-tuples-hook
call-recompile-hook call-recompile-hook
call-update-tuples-hook call-update-tuples-hook
dup [ drop crossref? ] assoc-contains? modify-code-heap dup [ drop crossref? ] assoc-contains? modify-code-heap
changed-definitions notify-definition-observers ; updated-definitions notify-definition-observers ;
: with-compilation-unit ( quot -- ) : with-compilation-unit ( quot -- )
[ [
H{ } clone changed-words set H{ } clone changed-definitions set
H{ } clone forgotten-definitions set H{ } clone forgotten-definitions set
H{ } clone outdated-tuples set H{ } clone outdated-tuples set
<definitions> new-definitions set <definitions> new-definitions set

View File

@ -5,6 +5,13 @@ USING: kernel sequences namespaces assocs graphs ;
ERROR: no-compilation-unit definition ; ERROR: no-compilation-unit definition ;
SYMBOL: changed-definitions
: changed-definition ( defspec -- )
dup changed-definitions get
[ no-compilation-unit ] unless*
set-at ;
GENERIC: where ( defspec -- loc ) GENERIC: where ( defspec -- loc )
M: object where drop f ; M: object where drop f ;

View File

@ -144,19 +144,12 @@ PRIVATE>
: redefined ( word -- ) : redefined ( word -- )
H{ } clone visited [ (redefined) ] with-variable ; H{ } clone visited [ (redefined) ] with-variable ;
SYMBOL: changed-words
: changed-word ( word -- )
dup changed-words get
[ no-compilation-unit ] unless*
set-at ;
: define ( word def -- ) : define ( word def -- )
[ ] like [ ] like
over unxref over unxref
over redefined over redefined
over set-word-def over set-word-def
dup changed-word dup changed-definition
dup crossref? [ dup xref ] when drop ; dup crossref? [ dup xref ] when drop ;
: define-declared ( word def effect -- ) : define-declared ( word def effect -- )

View File

@ -1,4 +1,4 @@
! Copyright (C) 2005, 2007 Slava Pestov. ! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel parser sequences words help help.topics USING: arrays kernel parser sequences words help help.topics
namespaces vocabs definitions compiler.units ; namespaces vocabs definitions compiler.units ;
@ -16,4 +16,7 @@ IN: help.syntax
over add-article >link r> remember-definition ; parsing over add-article >link r> remember-definition ; parsing
: ABOUT: : ABOUT:
scan-object in get vocab set-vocab-help ; parsing scan-object
in get vocab
dup changed-definition
set-vocab-help ; parsing