mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 07:33:01 +00:00 
			
		
		
		
	Fix regression in while loops inside each macros.
There was a specialization for `(while (not= nil _) ...)` that was incorrect when the while loop regresses to a thunk.
This commit is contained in:
		| @@ -2115,7 +2115,7 @@ | |||||||
|   (if-let [check (in module/cache fullpath)] |   (if-let [check (in module/cache fullpath)] | ||||||
|     check |     check | ||||||
|     (do |     (do | ||||||
|       (def loader (module/loaders mod-kind)) |       (def loader (if (keyword? mod-kind) (module/loaders mod-kind) mod-kind)) | ||||||
|       (unless loader (error (string "module type " mod-kind " unknown"))) |       (unless loader (error (string "module type " mod-kind " unknown"))) | ||||||
|       (def env (loader fullpath args)) |       (def env (loader fullpath args)) | ||||||
|       (put module/cache fullpath env) |       (put module/cache fullpath env) | ||||||
|   | |||||||
| @@ -630,7 +630,7 @@ static JanetSlot janetc_while(JanetFopts opts, int32_t argn, const Janet *argv) | |||||||
|         janetc_scope(&tempscope, c, JANET_SCOPE_FUNCTION, "while-iife"); |         janetc_scope(&tempscope, c, JANET_SCOPE_FUNCTION, "while-iife"); | ||||||
|  |  | ||||||
|         /* Recompile in the function scope */ |         /* Recompile in the function scope */ | ||||||
|         cond = janetc_value(subopts, argv[0]); |         cond = janetc_value(subopts, condform); | ||||||
|         if (!(cond.flags & JANET_SLOT_CONSTANT)) { |         if (!(cond.flags & JANET_SLOT_CONSTANT)) { | ||||||
|             /* If not an infinite loop, return nil when condition false */ |             /* If not an infinite loop, return nil when condition false */ | ||||||
|             janetc_emit_si(c, ifjmp, cond, 2, 0); |             janetc_emit_si(c, ifjmp, cond, 2, 0); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose