mirror of
https://github.com/morluto/rea
synced 2026-10-26 22:28:27 -04:00
fix(javascript): preserve semantic query identity and source coverage
This commit is contained in:
@@ -27,8 +27,12 @@ export function* projectSemanticObjects(
|
||||
);
|
||||
for (const [index, operation] of context.ir.objectOperations.entries()) {
|
||||
if (index % 64 === 0) yield;
|
||||
const occurrence = addObjectOccurrence(context, operation);
|
||||
const target = objectTarget(context, values, operation);
|
||||
const occurrence = addObjectOccurrence(
|
||||
context,
|
||||
operation,
|
||||
target.slotApplicability,
|
||||
);
|
||||
const ends = objectRelationEnds(context, operation, occurrence, target);
|
||||
const resolved =
|
||||
operation.resolution === "complete" &&
|
||||
@@ -57,6 +61,7 @@ interface ObjectTarget {
|
||||
readonly slot: JavaScriptSemanticGraphNode | null;
|
||||
readonly presence: JavaScriptSemanticSlotPresence;
|
||||
readonly receiverResolved: boolean;
|
||||
readonly slotApplicability: "resolved" | "unresolved";
|
||||
}
|
||||
|
||||
const objectTarget = (
|
||||
@@ -82,6 +87,7 @@ const objectTarget = (
|
||||
slot: null,
|
||||
presence: "unknown-coverage",
|
||||
receiverResolved: false,
|
||||
slotApplicability: "unresolved",
|
||||
};
|
||||
const fact = semanticSlotAtPath(value, operation.propertyPath);
|
||||
if (operation.propertyPath.length === 0)
|
||||
@@ -90,6 +96,7 @@ const objectTarget = (
|
||||
slot: null,
|
||||
presence: fact.presence,
|
||||
receiverResolved: semanticContainer(value) !== null,
|
||||
slotApplicability: "unresolved",
|
||||
};
|
||||
const slot = semanticPropertySlot(
|
||||
context,
|
||||
@@ -104,6 +111,7 @@ const objectTarget = (
|
||||
return {
|
||||
objectNode: slot,
|
||||
slot,
|
||||
slotApplicability: "resolved",
|
||||
presence: fact.presence,
|
||||
receiverResolved:
|
||||
receiver.presence === "present" &&
|
||||
@@ -138,6 +146,7 @@ const objectRelationEnds = (
|
||||
const addObjectOccurrence = (
|
||||
context: SemanticFlowProjectionContext,
|
||||
operation: JavaScriptSemanticObjectOperation,
|
||||
slotApplicability: ObjectTarget["slotApplicability"],
|
||||
): JavaScriptSemanticGraphNode | null =>
|
||||
retainSemanticGraphNode(context.state, context.file, {
|
||||
kind: "expression",
|
||||
@@ -156,6 +165,7 @@ const addObjectOccurrence = (
|
||||
operation_kind: operation.kind,
|
||||
property_path:
|
||||
operation.propertyPath === null ? null : [...operation.propertyPath],
|
||||
property_slot_resolution: slotApplicability,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user