effects.parser: allow generic methods not in current vocabs.
							parent
							
								
									57f434b80e
								
							
						
					
					
						commit
						24d9e3a491
					
				| 
						 | 
				
			
			@ -1,7 +1,8 @@
 | 
			
		|||
! Copyright (C) 2008, 2010 Slava Pestov.
 | 
			
		||||
! See http://factorcode.org/license.txt for BSD license.
 | 
			
		||||
USING: arrays combinators continuations effects kernel lexer
 | 
			
		||||
make parser sequences sets splitting vocabs.parser words ;
 | 
			
		||||
USING: accessors arrays combinators continuations effects kernel
 | 
			
		||||
lexer make namespaces parser sequences sets splitting
 | 
			
		||||
vocabs.parser words ;
 | 
			
		||||
IN: effects.parser
 | 
			
		||||
 | 
			
		||||
DEFER: parse-effect
 | 
			
		||||
| 
						 | 
				
			
			@ -57,11 +58,11 @@ CONSTANT: in-definition HS{ }
 | 
			
		|||
ERROR: can't-nest-definitions word ;
 | 
			
		||||
 | 
			
		||||
: set-in-definition ( -- )
 | 
			
		||||
    current-vocab in-definition ?adjoin
 | 
			
		||||
    manifest get current-vocab>> t or in-definition ?adjoin
 | 
			
		||||
    [ last-word can't-nest-definitions ] unless ;
 | 
			
		||||
 | 
			
		||||
: unset-in-definition ( -- )
 | 
			
		||||
    current-vocab in-definition delete ;
 | 
			
		||||
    manifest get current-vocab>> t or in-definition delete ;
 | 
			
		||||
 | 
			
		||||
: with-definition ( quot -- )
 | 
			
		||||
    [ set-in-definition ] prepose [ unset-in-definition ] [ ] cleanup ; inline
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -251,7 +251,7 @@ DEFER: foo
 | 
			
		|||
] unit-test
 | 
			
		||||
 | 
			
		||||
{ } [
 | 
			
		||||
    "IN: azz2 USE: azz M: my-class a-generic ;"
 | 
			
		||||
    "USE: azz M: my-class a-generic ;"
 | 
			
		||||
    <string-reader> "azz-2" parse-stream drop
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +261,7 @@ DEFER: foo
 | 
			
		|||
] unit-test
 | 
			
		||||
 | 
			
		||||
{ } [
 | 
			
		||||
    "IN: azz-2 USE: azz USE: math M: integer a-generic ;"
 | 
			
		||||
    "USE: azz USE: math M: integer a-generic ;"
 | 
			
		||||
    <string-reader> "azz-2" parse-stream drop
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue