43 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Factor
		
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Factor
		
	
	
USING: accessors arrays byte-arrays compiler.tree
 | 
						|
compiler.tree.propagation.copy compiler.tree.propagation.info
 | 
						|
compiler.tree.propagation.slots hashtables kernel math math.intervals
 | 
						|
namespaces sequences strings tools.test ;
 | 
						|
IN: compiler.tree.propagation.slots.tests
 | 
						|
 | 
						|
: indexize ( seq -- assoc )
 | 
						|
    [ swap 2array ] map-index ;
 | 
						|
 | 
						|
: setup-value-infos ( value-infos -- )
 | 
						|
    indexize >hashtable 1array value-infos set
 | 
						|
    H{ { 0 0 } { 1 1 } { 2 2 } } copies set ;
 | 
						|
 | 
						|
{ t } [
 | 
						|
    \ <array> sequence-constructor?
 | 
						|
] unit-test
 | 
						|
 | 
						|
{
 | 
						|
    T{ value-info-state
 | 
						|
       { class array }
 | 
						|
       { interval full-interval }
 | 
						|
       { slots
 | 
						|
         {
 | 
						|
             T{ value-info-state
 | 
						|
                { class fixnum }
 | 
						|
                { interval
 | 
						|
                  T{ interval
 | 
						|
                     { from { 7 t } }
 | 
						|
                     { to { 7 t } }
 | 
						|
                  }
 | 
						|
                }
 | 
						|
                { literal 7 }
 | 
						|
                { literal? t }
 | 
						|
             }
 | 
						|
         }
 | 
						|
       }
 | 
						|
    }
 | 
						|
} [
 | 
						|
    { 7 f } [ <literal-info> ] map setup-value-infos
 | 
						|
    { 0 1 } { 2 } \ <array> <#call> dup word>>
 | 
						|
    propagate-sequence-constructor first
 | 
						|
] unit-test
 |