diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-25 22:21:20 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2015-06-25 22:21:20 +0300 |
commit | 0302c2f241b0a4ab47a0e60213c132c4135fed93 (patch) | |
tree | 87a499985100b2cf726a358bf8ee06d9d2696dc0 /builtin.c | |
parent | a3e0954544c7cc4f34b710ac863d56419b57915a (diff) | |
download | egawk-0302c2f241b0a4ab47a0e60213c132c4135fed93.tar.gz egawk-0302c2f241b0a4ab47a0e60213c132c4135fed93.tar.bz2 egawk-0302c2f241b0a4ab47a0e60213c132c4135fed93.zip |
More work straightening out typeof, including tests.
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -2144,7 +2144,9 @@ do_print(int nargs, int redirtype) fatal(_("attempt to use array `%s' in a scalar context"), array_vname(tmp)); } - if ((tmp->flags & (NUMBER|STRING)) == NUMBER) { + if (tmp->type == Node_typedregex) + args_array[i] = force_string(tmp); + else if ((tmp->flags & (NUMBER|STRING)) == NUMBER) { if (OFMTidx == CONVFMTidx) args_array[i] = force_string(tmp); else @@ -3877,11 +3879,14 @@ do_typeof(int nargs) arg = POP(); switch (arg->type) { case Node_var_array: + /* Node_var_array is never UPREF'ed */ res = "array"; deref = false; break; case Node_typedregex: + /* Op_push_re does not UPREF */ res = "regexp"; + deref = false; break; case Node_val: case Node_var: @@ -3894,6 +3899,7 @@ do_typeof(int nargs) break; case Node_var_new: res = "untyped"; + deref = false; break; default: fatal(_("typeof: unknown argument type `%s'"), |