mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
fix(javascript): capture primitive return values at evaluation
This commit is contained in:
1 parent
5a099ef9ef
commit
27b077edea
2 files changed
+9
-7
No files matched your search
@@ -1000,7 +1000,7 @@ const retainedInitializerOrigins = (
|
||||
};
|
||||
};
|
||||
|
||||
/** Locate a capture only in an unconditional declaration or literal initializer. */
|
||||
/** Locate an initializer or completed return-expression capture in its body. */
|
||||
export const semanticCapturePosition = (
|
||||
node: t.Node,
|
||||
parents: WeakMap<t.Node, t.Node>,
|
||||
@@ -1010,6 +1010,8 @@ export const semanticCapturePosition = (
|
||||
const direct = directInitializerPosition(current, parents);
|
||||
if (direct !== null) return direct;
|
||||
const parent = parents.get(current);
|
||||
if (t.isReturnStatement(parent) && parent.argument === current)
|
||||
return statementPosition(parent, parents);
|
||||
if (
|
||||
t.isObjectProperty(parent) &&
|
||||
parent.value === current &&
|
||||
|
||||
@@ -257,12 +257,12 @@ export const evaluateSemanticExpression = (
|
||||
dependence: { lowest: CALLER_INDEPENDENT },
|
||||
memo: createEvaluationMemo(state),
|
||||
};
|
||||
return evaluateExpression(
|
||||
node,
|
||||
capturePoint === undefined
|
||||
? context
|
||||
: (captureContextAt(capturePoint, context) ?? context),
|
||||
);
|
||||
return capturePoint === undefined
|
||||
? evaluateCapturedExpression(node, context)
|
||||
: evaluateExpression(
|
||||
node,
|
||||
captureContextAt(capturePoint, context) ?? context,
|
||||
);
|
||||
};
|
||||
|
||||
/** Resolve an expression using the same alias and module provenance owner. */
|
||||
|
||||
Reference in new issue
Block a user