summaryrefslogtreecommitdiff
path: root/gawkapi.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2012-12-18 16:37:19 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2012-12-18 16:37:19 -0500
commit886be6b488e3fa72f78979c3a2cd7d31a3bc6a85 (patch)
tree89fc1fd03f2f55d93b2f325a3d9c836c3e59c08f /gawkapi.c
parent320d5302c4a39ea7936950b2e663e37683b39fe0 (diff)
downloadgawk-886be6b488e3fa72f78979c3a2cd7d31a3bc6a85.tar.gz
Fix API to update the node type to Node_var when setting an undefined variable.
Diffstat (limited to 'gawkapi.c')
-rw-r--r--gawkapi.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gawkapi.c b/gawkapi.c
index b67275c1..cd09cddc 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -603,6 +603,9 @@ sym_update_real(awk_ext_id_t id,
&& (node->type == Node_var || node->type == Node_var_new)) {
unref(node->var_value);
node->var_value = awk_value_to_node(value);
+ if (node->type == Node_var_new && value->val_type != AWK_UNDEFINED)
+ node->type = Node_var;
+
/* let the extension change its own variable */
if (is_const)
node->var_assign = set_constant;