[njs] Fixed njs_is_accessor_descriptor().

Dmitry Volyntsev xeioex at nginx.com
Thu Aug 8 11:20:11 UTC 2019


details:   https://hg.nginx.org/njs/rev/6caf4d7c0846
branches:  
changeset: 1116:6caf4d7c0846
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Aug 08 14:19:54 2019 +0300
description:
Fixed njs_is_accessor_descriptor().

diffstat:

 src/njs_object.h |  3 ++-
 src/njs_value.h  |  4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r e47f82b5f2ca -r 6caf4d7c0846 src/njs_object.h
--- a/src/njs_object.h	Mon Aug 05 17:10:59 2019 +0300
+++ b/src/njs_object.h	Thu Aug 08 14:19:54 2019 +0300
@@ -13,7 +13,8 @@
 
 
 #define njs_is_accessor_descriptor(prop)                                      \
-    (njs_is_valid(&(prop)->getter) || njs_is_valid(&(prop)->setter))
+    (njs_is_function_or_undefined(&(prop)->getter)                            \
+     || njs_is_function_or_undefined(&(prop)->setter))
 
 
 #define njs_is_generic_descriptor(prop)                                       \
diff -r e47f82b5f2ca -r 6caf4d7c0846 src/njs_value.h
--- a/src/njs_value.h	Mon Aug 05 17:10:59 2019 +0300
+++ b/src/njs_value.h	Thu Aug 08 14:19:54 2019 +0300
@@ -537,6 +537,10 @@ typedef struct {
     ((value)->type == NJS_FUNCTION)
 
 
+#define njs_is_function_or_undefined(value)                                   \
+    ((value)->type == NJS_FUNCTION || (value)->type == NJS_UNDEFINED)
+
+
 #define njs_is_regexp(value)                                                  \
     ((value)->type == NJS_REGEXP)
 


More information about the nginx-devel mailing list