From 64d23c05250991f436d2c29e219904f5bb295300 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Wed, 25 Oct 2023 01:27:22 +0200 Subject: [PATCH] fix(shader-ast): fix if() handling in scopedChildren() - include test in returned children otherwise any referenced functions there will not be captured in dependencies --- packages/shader-ast/src/ast/scope.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shader-ast/src/ast/scope.ts b/packages/shader-ast/src/ast/scope.ts index eae61091a1..d8e6dcb98c 100644 --- a/packages/shader-ast/src/ast/scope.ts +++ b/packages/shader-ast/src/ast/scope.ts @@ -30,8 +30,8 @@ export const scopedChildren = (t: Term) => ? (>t).scope.body : t.tag === "if" ? (t).f - ? (t).t.body.concat((t).f!.body) - : (t).t.body + ? [(t).test, ...(t).t.body, ...(t).f!.body] + : [(t).test, ...(t).t.body] : undefined; /**