diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-23 14:16:02 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-23 14:16:02 +0200 |
commit | cfa30992be7c98184d68c3afbb489d47dddcf0fa (patch) | |
tree | dd68f30402ec509fb290a32a18996923407e4179 /awkgram.y | |
parent | 15e58aea1441250cb85f760e644f97cd6efed35f (diff) | |
download | egawk-cfa30992be7c98184d68c3afbb489d47dddcf0fa.tar.gz egawk-cfa30992be7c98184d68c3afbb489d47dddcf0fa.tar.bz2 egawk-cfa30992be7c98184d68c3afbb489d47dddcf0fa.zip |
Bug fixes from John Haque.
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 * |