aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-12-27 21:59:23 +0200
committerArnold D. Robbins <arnold@skeeve.com>2015-12-27 21:59:23 +0200
commit639cdfb2b05acb1b2c3b5efea0b175da23306bc4 (patch)
treec640a1fd734050942568a4f5a93fef3f4f373647 /awkgram.c
parentf64ff5401e1560fc16146fe5b5d0f0991ee11d49 (diff)
parent0122571e049073622d9f0bb6eaeed5f52abd38bc (diff)
downloadegawk-639cdfb2b05acb1b2c3b5efea0b175da23306bc4.tar.gz
egawk-639cdfb2b05acb1b2c3b5efea0b175da23306bc4.tar.bz2
egawk-639cdfb2b05acb1b2c3b5efea0b175da23306bc4.zip
Merge branch 'master' into feature/cmake
Diffstat (limited to 'awkgram.c')
-rw-r--r--awkgram.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/awkgram.c b/awkgram.c
index efe9e98a..61a6de9d 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -7673,14 +7673,12 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
*/
INSTRUCTION *ip;
+ bool setup_else_part = true;
if (false_branch == NULL) {
false_branch = list_create(instruction(Op_no_op));
- if (elsep != NULL) { /* else { } */
- if (do_pretty_print)
- (void) list_prepend(false_branch, elsep);
- else
- bcfree(elsep);
+ if (elsep == NULL) { /* else { } */
+ setup_else_part = false;
}
} else {
/* assert(elsep != NULL); */
@@ -7688,6 +7686,9 @@ mk_condition(INSTRUCTION *cond, INSTRUCTION *ifp, INSTRUCTION *true_branch,
/* avoid a series of no_op's: if .. else if .. else if .. */
if (false_branch->lasti->opcode != Op_no_op)
(void) list_append(false_branch, instruction(Op_no_op));
+ }
+
+ if (setup_else_part) {
if (do_pretty_print) {
(void) list_prepend(false_branch, elsep);
false_branch->nexti->branch_end = false_branch->lasti;