fix: when capturing, must check if already in captures

This commit is contained in:
TopchetoEU 2024-12-10 00:43:15 +02:00
parent db45eb529d
commit db241919f2
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -19,7 +19,7 @@ public final class FunctionScope {
public final boolean passthrough;
private Variable addCaptured(Variable var, boolean captured) {
if (captured && !this.capturables.has(var)) this.capturables.add(var);
if (captured && !this.capturables.has(var) && !this.captures.has(var)) this.capturables.add(var);
return var;
}