mirror of
				https://github.com/janet-lang/janet
				synced 2025-11-04 09:33:02 +00:00 
			
		
		
		
	use janet_checktype over janet_type and ==
In destructure janet_type(_) == JANET_SYMBOL was used to check if a value was a symbol. This commit replaces that with the janet_checktype function, because that function is used for the same purpose in other places.
This commit is contained in:
		@@ -155,13 +155,13 @@ static int destructure(JanetCompiler *c,
 | 
			
		||||
                JanetSlot nextright = janetc_farslot(c);
 | 
			
		||||
                Janet subval = values[i];
 | 
			
		||||
 | 
			
		||||
                if (janet_type(subval) == JANET_SYMBOL && !janet_cstrcmp(janet_unwrap_symbol(subval), "&")) {
 | 
			
		||||
                if (janet_checktype(subval, JANET_SYMBOL) && !janet_cstrcmp(janet_unwrap_symbol(subval), "&")) {
 | 
			
		||||
                    if (i + 1 >= len) {
 | 
			
		||||
                        janetc_cerror(c, "expected symbol following '& in destructuring pattern");
 | 
			
		||||
                        return 1;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (janet_type(values[i + 1]) != JANET_SYMBOL) {
 | 
			
		||||
                    if (!janet_checktype(values[i + 1], JANET_SYMBOL)) {
 | 
			
		||||
                        janetc_error(c, janet_formatc("expected symbol following '& in destructuring pattern, found %q", values[i + 1]));
 | 
			
		||||
                        return 1;
 | 
			
		||||
                    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user