From: Igor Sysoev Date: Thu, 21 Jul 2016 18:37:46 +0000 (+0300) Subject: A fix of code generation of logical operations. X-Git-Tag: 0.1.0~3 X-Git-Url: http://git.kaiwu.me/sitemap.xml?a=commitdiff_plain;h=6b3e1f2dfd26dcd02945a7dfbd2cca1e18a13243;p=njs.git A fix of code generation of logical operations. --- diff --git a/njs/njs_generator.c b/njs/njs_generator.c index a06dd512..feacaae4 100644 --- a/njs/njs_generator.c +++ b/njs/njs_generator.c @@ -1666,11 +1666,6 @@ njs_generate_test_jump_expression(njs_vm_t *vm, njs_parser_t *parser, test_jump->code.retval = NJS_VMCODE_RETVAL; test_jump->value = node->left->index; - ret = njs_generator_node_index_release(vm, parser, node->left); - if (nxt_slow_path(ret != NXT_OK)) { - return ret; - } - node->index = njs_generator_dest_index(vm, parser, node); if (nxt_slow_path(node->index == NJS_INDEX_ERROR)) { return node->index; diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index 404d2553..a9ebabba 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -1476,6 +1476,9 @@ static njs_unit_test_t njs_test[] = { nxt_string("var a = 3; if (true) if (false); else; a = 2; a"), nxt_string("2") }, + { nxt_string("var a = [3], b; if (1==1||2==2) { b = '1'+'2'+a[0] }; b }"), + nxt_string("123") }, + /* do while. */ { nxt_string("do { break } if (false)"),