diff directive.c @ 72:b1d0f10e8d36

handle nested ifs correctly
author David A. Holland
date Mon, 10 Jun 2013 16:20:33 -0400
parents f8507e5ed84c
children 123168887da8
line wrap: on
line diff
--- a/directive.c	Mon Jun 10 16:05:42 2013 -0400
+++ b/directive.c	Mon Jun 10 16:20:33 2013 -0400
@@ -138,7 +138,14 @@
 void
 ifstate_push(struct place *p, bool startstate)
 {
-	ifstate = ifstate_create(ifstate, p, startstate);
+	struct ifstate *newstate;
+
+	newstate = ifstate_create(ifstate, p, startstate);
+	if (!ifstate->curtrue) {
+		newstate->curtrue = false;
+		newstate->evertrue = true;
+	}
+	ifstate = newstate;
 }
 
 static