fix(javascript): preserve copied values and export publication lifetimes

This commit is contained in:
morluto committed 2026-10-24 03:10:43 +08:00
1 parent c8f8ec656c
commit 2206822109
8 files changed
+281 -35

No files matched your search

@@ -4,6 +4,20 @@ import {
type SymbolicValue,
} from "./javascriptSymbolicValues.js";
/** Shared branch decision after each value lattice establishes truth/nullishness. */
export const logicalRightOperand = (
operator: t.LogicalExpression["operator"],
truth: boolean | undefined,
nullish: boolean | undefined,
): boolean | undefined =>
operator === "??"
? nullish
: truth === undefined
? undefined
: operator === "&&"
? truth
: !truth;
/** Whether short-circuit evaluation reaches the right operand; unknown stays unknown. */
export const symbolicLogicalRight = (
operator: t.LogicalExpression["operator"],
@@ -36,7 +50,7 @@ export const symbolicLogicalRight = (
: undefined;
}
const truth = symbolicTruth(left);
return truth === undefined ? undefined : operator === "&&" ? truth : !truth;
return logicalRightOperand(operator, truth, undefined);
};
/** Only definite synchronous exits; unsupported control flow stays unknown. */