mirror of
https://github.com/morluto/rea.git
synced 2026-10-21 21:32:26 -05:00
fix(javascript): retain uncertainty for conditionally skipped writes
Own skipped-write interpretation at definition collection, including conditional branches, loop iterations and optional-chain arguments. Remove the narrower initializer-only representation. Fixes #2562
This commit is contained in:
1 parent
36c91428fc
commit
410537667e
7 files changed
+172
-33
No files matched your search
@@ -360,6 +360,11 @@ const evaluateBinding = (
|
||||
const initializer = binding.initializers[0];
|
||||
if (initializer === undefined)
|
||||
return { status: "unknown", reason: "Missing binding initializer." };
|
||||
if (context.state.conditionallySkippedExpressions.has(initializer.node))
|
||||
return {
|
||||
status: "unknown",
|
||||
reason: `Binding ${binding.name} may remain uninitialized.`,
|
||||
};
|
||||
const position = context.bindings.size;
|
||||
const callerDependence = context.dependence.lowest;
|
||||
context.dependence.lowest = CALLER_INDEPENDENT;
|
||||
@@ -817,7 +822,7 @@ const provenanceForBindingUncached = (
|
||||
({ kind }) => kind === "assignment",
|
||||
);
|
||||
const conditionallyInitialized = binding.initializers.some(({ node }) =>
|
||||
context.state.conditionalInitializers.has(node),
|
||||
context.state.conditionallySkippedExpressions.has(node),
|
||||
);
|
||||
if (
|
||||
provenance.status !== "module" ||
|
||||
@@ -828,7 +833,7 @@ const provenanceForBindingUncached = (
|
||||
provenance.origins,
|
||||
assigned
|
||||
? `Binding ${binding.name} may be reassigned.`
|
||||
: `Binding ${binding.name} is conditionally initialized.`,
|
||||
: `Binding ${binding.name} may remain uninitialized.`,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user