rc

[fork] interactive rc shell
Log | Files | Refs | README | LICENSE

commit eb594861d41090b53272a6bc8941bf2075c4311f
parent c95bdf7ce9be6c6ed8ca4b0a474fc4947836eba9
Author: Bert Münnich <ber.t@posteo.de>
Date:   Fri, 26 Feb 2016 23:32:48 +0100

Break out of loops through local variable blocks

This code:

while () {
	var = 1 {
		break
	}
}

caused an 'break outside of loop' error. Handling eVarstack like eArena in
rc_raise() fixes this.

Diffstat:
Mexcept.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/except.c b/except.c @@ -66,7 +66,7 @@ extern void rc_raise(ecodes e) { exit(1); /* child processes exit on an error/signal */ for (; estack != NULL; estack = estack->prev) if (estack->e != e) { - if (e == eBreak && estack->e != eArena) + if (e == eBreak && estack->e != eArena && estack->e != eVarstack) rc_error("break outside of loop"); else if (e == eReturn && estack->e == eError) /* can return from loops inside functions */ rc_error("return outside of function");