aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-12 17:44:05 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-12 17:44:05 -0400
commit6aabed4fcc6823466e78593b93ceadd095f7463f (patch)
tree8d3e48568b1cd9a312a3d4c548aa67489fffaa39 /ast.c
parentc139ba2aae50222595bc95db804ab5ded74ba51c (diff)
Fix some COW bugs for arrays/tables/sets
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ast.c b/ast.c
index d3b5b3c4..2e9afaed 100644
--- a/ast.c
+++ b/ast.c
@@ -200,7 +200,7 @@ bool is_idempotent(ast_t *ast)
case Int: case Bool: case Num: case Var: case Nil: case TextLiteral: return true;
case Index: {
auto index = Match(ast, Index);
- return (index->index == NULL) && is_idempotent(index->indexed);
+ return is_idempotent(index->indexed) && index->index != NULL && is_idempotent(index->index);
}
case FieldAccess: {
auto access = Match(ast, FieldAccess);