aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/builtin.c b/builtin.c
index 7ef2acd8..9b5609fa 100644
--- a/builtin.c
+++ b/builtin.c
@@ -2678,6 +2678,8 @@ do_match(int nargs)
dest = POP_PARAM();
if (dest->type != Node_var_array)
fatal(_("match: third argument is not an array"));
+ check_symtab_functab(dest, "match",
+ _("%s: cannot use %s as third argument"));
assoc_clear(dest);
}
tre = POP();
@@ -4328,3 +4330,15 @@ fmt:
}
return buf;
}
+
+
+/* check_symtab_functab --- check if dest is SYMTAB or FUNCTAB, fatal if so */
+
+void
+check_symtab_functab(NODE *dest, const char *fname, const char *msg)
+{
+ if (dest == symbol_table)
+ fatal(msg, fname, "SYMTAB");
+ else if (dest == func_table)
+ fatal(msg, fname, "FUNCTAB");
+}