Welcome! Log In Create A New Profile

Advanced

[njs] Simplified condition in njs_function_alloc().

Valentin Bartenev
May 04, 2019 10:00AM
details: https://hg.nginx.org/njs/rev/551d173ab9ec
branches:
changeset: 943:551d173ab9ec
user: Valentin Bartenev <vbart@nginx.com>
date: Sat May 04 05:52:15 2019 +0300
description:
Simplified condition in njs_function_alloc().

There's no reason to check both flags when one depends on another.
See just a few lines above: function->ctor = !lambda->arrow.

Now the condition is made similar to the one in njs_method_private_copy().

diffstat:

njs/njs_function.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diffs (18 lines):

diff -r fe74f3c7863a -r 551d173ab9ec njs/njs_function.c
--- a/njs/njs_function.c Sat May 04 00:56:39 2019 +0300
+++ b/njs/njs_function.c Sat May 04 05:52:15 2019 +0300
@@ -42,11 +42,11 @@ njs_function_alloc(njs_vm_t *vm, njs_fun
function->args_offset = 1;
function->u.lambda = lambda;

- if (lambda->arrow || !function->ctor) {
- function->object.shared_hash = vm->shared->arrow_instance_hash;
+ if (function->ctor) {
+ function->object.shared_hash = vm->shared->function_instance_hash;

} else {
- function->object.shared_hash = vm->shared->function_instance_hash;
+ function->object.shared_hash = vm->shared->arrow_instance_hash;
}

function->object.__proto__ = &vm->prototypes[NJS_PROTOTYPE_FUNCTION].object;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Simplified condition in njs_function_alloc().

Valentin Bartenev 205 May 04, 2019 10:00AM



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

Online Users

Guests: 110
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