aboutsummaryrefslogtreecommitdiffstats
path: root/gawkapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'gawkapi.c')
-rw-r--r--gawkapi.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gawkapi.c b/gawkapi.c
index f8d04986..0213936a 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -486,6 +486,16 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
return ret;
}
+static NODE *
+lookup_deferred(const char *name)
+{
+ NODE *node;
+
+ if ((node = lookup(name)) != NULL)
+ return node;
+ return deferred_create(name);
+}
+
/*
* Symbol table access:
* - No access to special variables (NF, etc.)
@@ -516,7 +526,7 @@ api_sym_lookup(awk_ext_id_t id,
if ( name == NULL
|| *name == '\0'
|| result == NULL
- || (node = lookup(name)) == NULL)
+ || (node = lookup_deferred(name)) == NULL)
return awk_false;
if (is_off_limits_var(name)) /* a built-in variable */
@@ -574,7 +584,7 @@ api_sym_update(awk_ext_id_t id,
return awk_false;
}
- node = lookup(name);
+ node = lookup_deferred(name);
if (node == NULL) {
/* new value to be installed */