[njs] Improved typeof for internal types.
Dmitry Volyntsev
xeioex at nginx.com
Fri Jul 12 20:31:14 UTC 2019
details: https://hg.nginx.org/njs/rev/b0084c55d444
branches:
changeset: 1044:b0084c55d444
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Fri Jul 12 23:30:22 2019 +0300
description:
Improved typeof for internal types.
diffstat:
njs/njs_value.c | 3 +++
njs/njs_value.h | 3 +++
njs/njs_vm.c | 6 +++---
njs/test/njs_unit_test.c | 2 +-
4 files changed, 10 insertions(+), 4 deletions(-)
diffs (54 lines):
diff -r 8cfbc7785708 -r b0084c55d444 njs/njs_value.c
--- a/njs/njs_value.c Fri Jul 12 21:18:30 2019 +0300
+++ b/njs/njs_value.c Fri Jul 12 23:30:22 2019 +0300
@@ -31,6 +31,9 @@ const njs_value_t njs_string_plus_infin
njs_string("Infinity");
const njs_value_t njs_string_nan = njs_string("NaN");
const njs_value_t njs_string_string = njs_string("string");
+const njs_value_t njs_string_data = njs_string("data");
+const njs_value_t njs_string_external = njs_string("external");
+const njs_value_t njs_string_invalid = njs_string("invalid");
const njs_value_t njs_string_object = njs_string("object");
const njs_value_t njs_string_function = njs_string("function");
const njs_value_t njs_string_memory_error = njs_string("MemoryError");
diff -r 8cfbc7785708 -r b0084c55d444 njs/njs_value.h
--- a/njs/njs_value.h Fri Jul 12 21:18:30 2019 +0300
+++ b/njs/njs_value.h Fri Jul 12 23:30:22 2019 +0300
@@ -743,6 +743,9 @@ extern const njs_value_t njs_string_min
extern const njs_value_t njs_string_plus_infinity;
extern const njs_value_t njs_string_nan;
extern const njs_value_t njs_string_string;
+extern const njs_value_t njs_string_data;
+extern const njs_value_t njs_string_external;
+extern const njs_value_t njs_string_invalid;
extern const njs_value_t njs_string_object;
extern const njs_value_t njs_string_function;
extern const njs_value_t njs_string_memory_error;
diff -r 8cfbc7785708 -r b0084c55d444 njs/njs_vm.c
--- a/njs/njs_vm.c Fri Jul 12 21:18:30 2019 +0300
+++ b/njs/njs_vm.c Fri Jul 12 23:30:22 2019 +0300
@@ -982,9 +982,9 @@ njs_vmcode_typeof(njs_vm_t *vm, njs_valu
&njs_string_boolean,
&njs_string_number,
&njs_string_string,
- &njs_string_undefined,
- &njs_string_undefined,
- &njs_string_undefined,
+ &njs_string_data,
+ &njs_string_external,
+ &njs_string_invalid,
&njs_string_undefined,
&njs_string_undefined,
&njs_string_undefined,
diff -r 8cfbc7785708 -r b0084c55d444 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Fri Jul 12 21:18:30 2019 +0300
+++ b/njs/test/njs_unit_test.c Fri Jul 12 23:30:22 2019 +0300
@@ -4998,7 +4998,7 @@ static njs_unit_test_t njs_test[] =
/* Externals. */
{ nxt_string("typeof $r"),
- nxt_string("undefined") },
+ nxt_string("external") },
{ nxt_string("var a = $r.uri, s = a.fromUTF8(); s.length +' '+ s"),
nxt_string("3 АБВ") },
More information about the nginx-devel
mailing list