diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-11-22 21:57:42 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-11-22 21:57:42 +0200 |
commit | f44bcf14b40716abe45306b0ca427a2b8359f28f (patch) | |
tree | e141fbe1264304e0a7b83bd40ec8bd57a18c1a84 /builtin.c | |
parent | 0c02a53775a80fe10dcd2b0ae5e857c1f22f8727 (diff) | |
parent | 4a7a1509991bfa9b79816a04fbee3398e3be6841 (diff) | |
download | egawk-f44bcf14b40716abe45306b0ca427a2b8359f28f.tar.gz egawk-f44bcf14b40716abe45306b0ca427a2b8359f28f.tar.bz2 egawk-f44bcf14b40716abe45306b0ca427a2b8359f28f.zip |
Merge branch 'gawk-5.1-stable'
Diffstat (limited to 'builtin.c')
-rw-r--r-- | builtin.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -4189,10 +4189,31 @@ do_typeof(int nargs) } break; case Node_var_new: - case Node_array_ref: res = "untyped"; deref = false; break; + case Node_array_ref: + /* + * function f(x) { + * print typeof(x) + * y = x + * print typeof(x) + * } + * + * BEGIN { + * print typeof(x) + * f(x) + * } + */ + if (arg->orig_array->type == Node_var + && (arg->orig_array->var_value == Nnull_string + || (arg->orig_array->var_value->flags & NULL_FIELD) != 0)) { + res = "unassigned"; + } else { + res = "untyped"; + } + deref = false; + break; case Node_var: /* * Note: this doesn't happen because the function calling code |