Welcome! Log In Create A New Profile

Advanced

[njs] Fixed "accumulative" mode of VM.

Dmitry Volyntsev
November 26, 2019 07:44AM
details: https://hg.nginx.org/njs/rev/8a41cab86cc2
branches:
changeset: 1258:8a41cab86cc2
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Tue Nov 26 15:01:02 2019 +0300
description:
Fixed "accumulative" mode of VM.

The issue was introduced in 452ce96df2e3.

This closes #258 issue on Github.

diffstat:

src/njs_vm.c | 2 +-
src/test/njs_interactive_test.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 851550b92d9d -r 8a41cab86cc2 src/njs_vm.c
--- a/src/njs_vm.c Mon Nov 25 17:54:58 2019 +0300
+++ b/src/njs_vm.c Tue Nov 26 15:01:02 2019 +0300
@@ -195,7 +195,7 @@ njs_vm_compile(njs_vm_t *vm, u_char **st

vm->variables_hash = scope->variables;

- if (vm->options.init) {
+ if (vm->options.init && !vm->options.accumulative) {
ret = njs_vm_init(vm);
if (njs_slow_path(ret != NJS_OK)) {
return ret;
diff -r 851550b92d9d -r 8a41cab86cc2 src/test/njs_interactive_test.c
--- a/src/test/njs_interactive_test.c Mon Nov 25 17:54:58 2019 +0300
+++ b/src/test/njs_interactive_test.c Tue Nov 26 15:01:02 2019 +0300
@@ -75,6 +75,16 @@ static njs_interactive_test_t njs_test[
{ njs_str("/abc/i.test('ABC')" ENTER),
njs_str("true") },

+ /* Accumulative mode. */
+
+ { njs_str("var a = 1" ENTER
+ "a" ENTER),
+ njs_str("1") },
+
+ { njs_str("Number.prototype.test = 'test'" ENTER
+ "Number.prototype.test" ENTER),
+ njs_str("test") },
+
/* Error handling */

{ njs_str("var a = ;" ENTER
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Fixed "accumulative" mode of VM.

Dmitry Volyntsev 51 November 26, 2019 07:44AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready