forget-all word
							parent
							
								
									5ecc094859
								
							
						
					
					
						commit
						6d3aa439c2
					
				| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
IN: temporary
 | 
			
		||||
USING: tools.test generic kernel definitions sequences ;
 | 
			
		||||
 | 
			
		||||
TUPLE: combination-1 ;
 | 
			
		||||
 | 
			
		||||
M: combination-1 perform-combination 2drop { } [ ] each [ ] ;
 | 
			
		||||
 | 
			
		||||
SYMBOL: generic-1
 | 
			
		||||
 | 
			
		||||
generic-1 T{ combination-1 } define-generic
 | 
			
		||||
 | 
			
		||||
[ ] <method> object \ generic-1 define-method
 | 
			
		||||
 | 
			
		||||
[ ] [ { combination-1 { object generic-1 } } forget-all ] unit-test
 | 
			
		||||
 | 
			
		||||
GENERIC: some-generic
 | 
			
		||||
 | 
			
		||||
USE: arrays
 | 
			
		||||
 | 
			
		||||
M: array some-generic ;
 | 
			
		||||
 | 
			
		||||
USE: bit-arrays
 | 
			
		||||
 | 
			
		||||
M: bit-array some-generic ;
 | 
			
		||||
 | 
			
		||||
USE: byte-arrays
 | 
			
		||||
 | 
			
		||||
M: byte-array some-generic ;
 | 
			
		||||
 | 
			
		||||
TUPLE: some-class ;
 | 
			
		||||
 | 
			
		||||
M: some-class some-generic ;
 | 
			
		||||
 | 
			
		||||
TUPLE: another-class some-generic ;
 | 
			
		||||
 | 
			
		||||
[ ] [
 | 
			
		||||
    { some-generic some-class { another-class some-generic } }
 | 
			
		||||
    forget-all
 | 
			
		||||
] unit-test
 | 
			
		||||
| 
						 | 
				
			
			@ -13,6 +13,8 @@ GENERIC: forget ( defspec -- )
 | 
			
		|||
 | 
			
		||||
M: object forget drop ;
 | 
			
		||||
 | 
			
		||||
: forget-all ( definitions -- ) [ forget ] each ;
 | 
			
		||||
 | 
			
		||||
GENERIC: synopsis* ( defspec -- )
 | 
			
		||||
 | 
			
		||||
GENERIC: definer ( defspec -- start end )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -94,7 +94,7 @@ M: method-spec forget first2 [ delete-at ] with-methods ;
 | 
			
		|||
    dup associate implementors* ;
 | 
			
		||||
 | 
			
		||||
: forget-methods ( class -- )
 | 
			
		||||
    [ implementors ] keep [ swap 2array forget ] curry each ;
 | 
			
		||||
    [ implementors ] keep [ swap 2array ] curry map forget-all ;
 | 
			
		||||
 | 
			
		||||
M: class forget ( class -- )
 | 
			
		||||
    dup forget-methods
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -416,7 +416,7 @@ SYMBOL: parse-hook
 | 
			
		|||
    ] keep ;
 | 
			
		||||
 | 
			
		||||
: forget-smudged ( -- )
 | 
			
		||||
    smudged-usage [ forget ] each
 | 
			
		||||
    smudged-usage forget-all
 | 
			
		||||
    over empty? [ 2dup smudged-usage-warning ] unless 2drop ;
 | 
			
		||||
 | 
			
		||||
: record-definitions ( file -- )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -159,9 +159,6 @@ GENERIC: see ( defspec -- )
 | 
			
		|||
M: word synopsis*
 | 
			
		||||
    dup word-synopsis ;
 | 
			
		||||
 | 
			
		||||
M: simple-generic synopsis*
 | 
			
		||||
    dup word-synopsis ;
 | 
			
		||||
 | 
			
		||||
M: standard-generic synopsis*
 | 
			
		||||
    dup seeing-word
 | 
			
		||||
    \ GENERIC# pprint-word
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,7 +71,7 @@ M: pathname where pathname-string 1 2array ;
 | 
			
		|||
: forget-source ( path -- )
 | 
			
		||||
    dup source-file
 | 
			
		||||
    dup unxref-source
 | 
			
		||||
    source-file-definitions [ drop forget ] assoc-each
 | 
			
		||||
    source-file-definitions keys forget-all
 | 
			
		||||
    source-files get delete-at ;
 | 
			
		||||
 | 
			
		||||
M: pathname forget pathname-string forget-source ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,14 @@ slots.private math namespaces sequences strings vectors sbufs
 | 
			
		|||
quotations assocs hashtables sorting math.parser words.private
 | 
			
		||||
vocabs ;
 | 
			
		||||
 | 
			
		||||
GENERIC: execute ( word -- )
 | 
			
		||||
 | 
			
		||||
M: word execute (execute) ;
 | 
			
		||||
 | 
			
		||||
: word ( -- word ) \ word get-global ;
 | 
			
		||||
 | 
			
		||||
: set-word ( word -- ) \ word set-global ;
 | 
			
		||||
 | 
			
		||||
GENERIC: execute ( word -- )
 | 
			
		||||
 | 
			
		||||
M: word execute (execute) ;
 | 
			
		||||
 | 
			
		||||
! Used by the compiler
 | 
			
		||||
SYMBOL: changed-words
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -201,7 +201,6 @@ M: word (forget-word)
 | 
			
		|||
    reveal ;
 | 
			
		||||
 | 
			
		||||
: forget-word ( word -- )
 | 
			
		||||
    dup f "methods" set-word-prop
 | 
			
		||||
    dup delete-xref
 | 
			
		||||
    dup unchanged-word
 | 
			
		||||
    (forget-word) ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue