aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
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);