mirror of
https://github.com/morluto/rea
synced 2026-10-28 15:07:26 -04:00
fix(javascript): preserve values captured before later assignments (#4196)
Select binding facts at reads without mixing whole-binding and temporal values. Share conditional activation rules, preserve partial expression order, and bound immutable ancestry work. Memoize temporal results within each query using initializer identity, capture point, budget and dependency proofs; preserve depth limits and source Evidence. Fixes #3881
This commit is contained in:
@@ -16,6 +16,7 @@ export const runtimeFunctionParameters = (
|
||||
*/
|
||||
export const unwrapJavaScriptExpression = (
|
||||
node: t.Node,
|
||||
options?: { readonly stopAtParentheses: boolean },
|
||||
): { readonly node: t.Node; readonly depth: number } => {
|
||||
let current = node;
|
||||
let depth = 0;
|
||||
@@ -28,6 +29,14 @@ export const unwrapJavaScriptExpression = (
|
||||
t.isTSInstantiationExpression(current) ||
|
||||
t.isTypeCastExpression(current)
|
||||
) {
|
||||
// Optional-chain grouping affects execution even when expression identity
|
||||
// is transparent. Keep every grouping boundary available to that consumer.
|
||||
if (
|
||||
options?.stopAtParentheses === true &&
|
||||
(t.isParenthesizedExpression(current) ||
|
||||
current.extra?.parenthesized === true)
|
||||
)
|
||||
break;
|
||||
current = current.expression;
|
||||
depth += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user