| 
									
										
										
										
											2009-04-21 17:09:53 -04:00
										 |  |  | USING: compiler definitions compiler.units tools.test arrays sequences words kernel | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | accessors namespaces fry eval ;
 | 
					
						
							| 
									
										
										
										
											2009-03-28 05:19:02 -04:00
										 |  |  | IN: compiler.units.tests | 
					
						
							| 
									
										
										
										
											2008-08-30 03:31:27 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-13 20:39:32 -04:00
										 |  |  | [ [ [ ] define-temp ] with-compilation-unit ] must-infer | 
					
						
							|  |  |  | [ [ [ ] define-temp ] with-nested-compilation-unit ] must-infer | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-30 03:31:27 -04:00
										 |  |  | [ flushed-dependency ] [ f flushed-dependency strongest-dependency ] unit-test | 
					
						
							|  |  |  | [ flushed-dependency ] [ flushed-dependency f strongest-dependency ] unit-test | 
					
						
							|  |  |  | [ inlined-dependency ] [ flushed-dependency inlined-dependency strongest-dependency ] unit-test | 
					
						
							|  |  |  | [ inlined-dependency ] [ called-dependency inlined-dependency strongest-dependency ] unit-test | 
					
						
							|  |  |  | [ flushed-dependency ] [ called-dependency flushed-dependency strongest-dependency ] unit-test | 
					
						
							|  |  |  | [ called-dependency ] [ called-dependency f strongest-dependency ] unit-test | 
					
						
							| 
									
										
										
										
											2009-01-22 22:22:28 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 19:20:47 -05:00
										 |  |  | ! Non-optimizing compiler bugs | 
					
						
							| 
									
										
										
										
											2009-01-22 22:22:28 -05:00
										 |  |  | [ 1 1 ] [ | 
					
						
							| 
									
										
										
										
											2009-04-21 17:09:53 -04:00
										 |  |  |     "A" "B" <word> [ [ [ 1 ] dip ] 2array 1array modify-code-heap ] keep
 | 
					
						
							| 
									
										
										
										
											2009-01-22 22:22:28 -05:00
										 |  |  |     1 swap execute
 | 
					
						
							| 
									
										
										
										
											2009-01-23 19:20:47 -05:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "A" "B" ] [ | 
					
						
							| 
									
										
										
										
											2009-04-21 17:09:53 -04:00
										 |  |  |     disable-compiler | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-23 19:20:47 -05:00
										 |  |  |     gensym "a" set
 | 
					
						
							|  |  |  |     gensym "b" set
 | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         "a" get [ "A" ] define | 
					
						
							|  |  |  |         "b" get "a" get '[ _ execute ] define | 
					
						
							|  |  |  |     ] with-compilation-unit | 
					
						
							|  |  |  |     "b" get execute
 | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         "a" get [ "B" ] define | 
					
						
							|  |  |  |     ] with-compilation-unit | 
					
						
							|  |  |  |     "b" get execute
 | 
					
						
							| 
									
										
										
										
											2009-04-21 17:09:53 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     enable-compiler | 
					
						
							| 
									
										
										
										
											2009-03-28 05:19:02 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-22 05:20:38 -04:00
										 |  |  | ! Check that we notify observers | 
					
						
							| 
									
										
										
										
											2009-03-28 05:19:02 -04:00
										 |  |  | SINGLETON: observer | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | observer add-definition-observer | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | SYMBOL: counter | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 0 counter set-global
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: observer definitions-changed 2drop global [ counter inc ] bind ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-22 05:20:38 -04:00
										 |  |  | [ gensym [ ] (( -- )) define-declared ] with-compilation-unit | 
					
						
							| 
									
										
										
										
											2009-03-28 05:19:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | [ 1 ] [ counter get-global ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | observer remove-definition-observer | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Notify observers with nested compilation units | 
					
						
							|  |  |  | observer add-definition-observer | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 0 counter set-global
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DEFER: nesting-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 16:49:21 -04:00
										 |  |  | [ ] [ "IN: compiler.units.tests << : nesting-test ( -- ) ; >>" eval( -- ) ] unit-test | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 13:45:57 -04:00
										 |  |  | observer remove-definition-observer |