aboutsummaryrefslogtreecommitdiffstats
path: root/awkgram.y
diff options
context:
space:
mode:
Diffstat (limited to 'awkgram.y')
-rw-r--r--awkgram.y16
1 files changed, 15 insertions, 1 deletions
diff --git a/awkgram.y b/awkgram.y
index 00569b2a..dd8cf87f 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -58,6 +58,7 @@ static int isarray(NODE *n);
static int include_source(INSTRUCTION *file);
static void next_sourcefile(void);
static char *tokexpand(void);
+static int is_deferred_variable(const char *name);
#define instruction(t) bcalloc(t, 1, 0)
@@ -4212,7 +4213,7 @@ func_install(INSTRUCTION *func, INSTRUCTION *def)
if (hp != NULL)
freenode(hp);
r = lookup(fname);
- if (r != NULL) {
+ if (r != NULL || is_deferred_variable(fname)) {
error_ln(func->source_line,
_("function name `%s' previously defined"), fname);
return -1;
@@ -4523,6 +4524,19 @@ register_deferred_variable(const char *name, NODE *(*load_func)(void))
deferred_variables = dv;
}
+/* is_deferred_variable --- check if NAME is a deferred variable */
+
+static int
+is_deferred_variable(const char *name)
+{
+ struct deferred_variable *dv;
+ for (dv = deferred_variables; dv != NULL; dv = dv->next)
+ if (strcmp(name, dv->name) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+
/* variable --- make sure NAME is in the symbol table */
NODE *