give a better error message when an invalid slot name is used in a tuple/struct literal
							parent
							
								
									d1c69efc0f
								
							
						
					
					
						commit
						748ba4b833
					
				| 
						 | 
					@ -174,6 +174,8 @@ M: no-method error.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: bad-slot-value summary drop "Bad store to specialized slot" ;
 | 
					M: bad-slot-value summary drop "Bad store to specialized slot" ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					M: bad-slot-name summary drop "Bad slot name in object literal" ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
M: no-math-method summary
 | 
					M: no-math-method summary
 | 
				
			||||||
    drop "No suitable arithmetic method" ;
 | 
					    drop "No suitable arithmetic method" ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,9 +99,17 @@ GENERIC# boa>object 1 ( class slots -- tuple )
 | 
				
			||||||
M: tuple-class boa>object
 | 
					M: tuple-class boa>object
 | 
				
			||||||
    swap prefix >tuple ;
 | 
					    swap prefix >tuple ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ERROR: bad-slot-name class slot ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					: check-slot-exists ( class initials slot-spec/f index/f name -- class initials slot-spec index )
 | 
				
			||||||
 | 
					    over [ drop ] [ nip nip nip bad-slot-name ] if ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					: slot-named-checked ( class initials name slots -- class initials slot-spec )
 | 
				
			||||||
 | 
					    over [ slot-named* ] dip check-slot-exists drop ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: assoc>object ( class slots values -- tuple )
 | 
					: assoc>object ( class slots values -- tuple )
 | 
				
			||||||
    [ [ [ initial>> ] map ] keep ] dip
 | 
					    [ [ [ initial>> ] map ] keep ] dip
 | 
				
			||||||
    swap [ [ slot-named* drop ] curry dip ] curry assoc-map
 | 
					    swap [ [ slot-named-checked ] curry dip ] curry assoc-map
 | 
				
			||||||
    [ dup <enum> ] dip update boa>object ;
 | 
					    [ dup <enum> ] dip update boa>object ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: parse-tuple-literal-slots ( class slots -- tuple )
 | 
					: parse-tuple-literal-slots ( class slots -- tuple )
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue