diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | builtin.c | 5 |
2 files changed, 9 insertions, 1 deletions
@@ -12,6 +12,11 @@ (initialize_watch_item): Ditto. (print_memory): Ditto. + Fix typeof to work on subarrays. Thanks, yet again, to + Hermann Peifer for the bug report. + + * builtin.c (do_typeof): Don't deref Node_var_array. + 2015-06-21 Arnold D. Robbins <arnold@skeeve.com> Fixes for typeof - Don't let typeof change an untyped variable @@ -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)); } |