From a3e0954544c7cc4f34b710ac863d56419b57915a Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 22 Jun 2015 22:56:06 +0300 Subject: Fix typeof to work correctly on subarrays. --- builtin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index 942a36dd..e476ec99 100644 --- a/builtin.c +++ b/builtin.c @@ -3872,11 +3872,13 @@ do_typeof(int nargs) { NODE *arg; char *res = "unknown"; + bool deref = true; arg = POP(); switch (arg->type) { case Node_var_array: res = "array"; + deref = false; break; case Node_typedregex: res = "regexp"; @@ -3899,7 +3901,8 @@ do_typeof(int nargs) break; } - DEREF(arg); + if (deref) + DEREF(arg); return make_string(res, strlen(res)); } -- cgit v1.2.3