diff options
Diffstat (limited to 'awkgram.y')
-rw-r--r-- | awkgram.y | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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 * |