aboutsummaryrefslogtreecommitdiffstats
path: root/interpret.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-04-11 21:08:06 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-04-11 21:08:06 -0700
commit51ca241352218e6da8db10fe07c90e229a0bc1f8 (patch)
tree3e8b4e28353bdb5b64f182737127a524b8e0e299 /interpret.h
parent3dd49d281145d457bf8fa834418c2a7ff38250bd (diff)
downloadegawk-51ca241352218e6da8db10fe07c90e229a0bc1f8.tar.gz
egawk-51ca241352218e6da8db10fe07c90e229a0bc1f8.tar.bz2
egawk-51ca241352218e6da8db10fe07c90e229a0bc1f8.zip
@let: bug re-using previously scalar location as array.
* test/let1.awk: New test case. * interpret.h (r_interpret): Our new Op_clear_var opcode should not only assign the null value to the variable, but reset its type to Node_var_new.
Diffstat (limited to 'interpret.h')
-rw-r--r--interpret.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/interpret.h b/interpret.h
index ef087951..0dc261d6 100644
--- a/interpret.h
+++ b/interpret.h
@@ -743,6 +743,7 @@ mod:
break;
case Op_clear_var:
+ {
/*
* Clear variable to the undefined value
* that is equal to 0 and "" represented by
@@ -751,7 +752,8 @@ mod:
* locals, which may re-use previously
* initialized frame locations.
*/
- lhs = get_lhs(pc->memory, false);
+ NODE *var = pc->memory;
+ lhs = get_lhs(var, false);
/*
* If it's already clear, nothing to do
@@ -760,6 +762,8 @@ mod:
unref(*lhs);
*lhs = dupnode(Nnull_string);
}
+ var->type = Node_var_new;
+ }
break;
case Op_store_field: