compiler.units: fix bug that came up recently with nested compilation units
parent
11be5a4bd5
commit
35acd71551
|
@ -0,0 +1,10 @@
|
||||||
|
USING: kernel tools.test definitions compiler.units ;
|
||||||
|
IN: compiler.tests.redefine21
|
||||||
|
|
||||||
|
[ ] [ : a ( -- ) ; << : b ( quot -- ) call a ; inline >> [ ] b ] unit-test
|
||||||
|
|
||||||
|
[ ] [ [ { a b } forget-all ] with-compilation-unit ] unit-test
|
||||||
|
|
||||||
|
[ ] [ : A ( -- ) ; << : B ( -- ) A ; inline >> B ] unit-test
|
||||||
|
|
||||||
|
[ ] [ [ { A B } forget-all ] with-compilation-unit ] unit-test
|
|
@ -168,6 +168,17 @@ M: object always-bump-effect-counter? drop f ;
|
||||||
notify-observers
|
notify-observers
|
||||||
] if-bootstrapping ;
|
] if-bootstrapping ;
|
||||||
|
|
||||||
|
TUPLE: nesting-observer new-words ;
|
||||||
|
|
||||||
|
M: nesting-observer definitions-changed new-words>> swap assoc-diff! drop ;
|
||||||
|
|
||||||
|
: add-nesting-observer ( -- )
|
||||||
|
new-words get nesting-observer boa
|
||||||
|
[ nesting-observer set ] [ add-definition-observer ] bi ;
|
||||||
|
|
||||||
|
: remove-nesting-observer ( -- )
|
||||||
|
nesting-observer get remove-definition-observer ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: with-nested-compilation-unit ( quot -- )
|
: with-nested-compilation-unit ( quot -- )
|
||||||
|
@ -178,19 +189,17 @@ PRIVATE>
|
||||||
H{ } clone outdated-generics set
|
H{ } clone outdated-generics set
|
||||||
H{ } clone outdated-tuples set
|
H{ } clone outdated-tuples set
|
||||||
H{ } clone new-words set
|
H{ } clone new-words set
|
||||||
[ finish-compilation-unit ] [ ] cleanup
|
add-nesting-observer
|
||||||
|
[
|
||||||
|
remove-nesting-observer
|
||||||
|
finish-compilation-unit
|
||||||
|
] [ ] cleanup
|
||||||
] with-scope ; inline
|
] with-scope ; inline
|
||||||
|
|
||||||
: with-compilation-unit ( quot -- )
|
: with-compilation-unit ( quot -- )
|
||||||
[
|
[
|
||||||
H{ } clone changed-definitions set
|
|
||||||
H{ } clone maybe-changed set
|
|
||||||
H{ } clone changed-effects set
|
|
||||||
H{ } clone outdated-generics set
|
|
||||||
H{ } clone forgotten-definitions set
|
|
||||||
H{ } clone outdated-tuples set
|
|
||||||
H{ } clone new-words set
|
|
||||||
<definitions> new-definitions set
|
<definitions> new-definitions set
|
||||||
<definitions> old-definitions set
|
<definitions> old-definitions set
|
||||||
[ finish-compilation-unit ] [ ] cleanup
|
H{ } clone forgotten-definitions set
|
||||||
|
with-nested-compilation-unit
|
||||||
] with-scope ; inline
|
] with-scope ; inline
|
||||||
|
|
Loading…
Reference in New Issue