in src/js/other-websites/fathom.js [2285:2315]
function updateFnode(leftResult) {
const leftType = self.lhs.guaranteedType();
// Get a fnode and a RHS transformer, whether a plain fnode is
// returned or a {fnode, rhsTransformer} pair:
const {fnode: leftFnode = leftResult, rhsTransformer = identity} = leftResult;
// Grab the fact from the RHS, and run the LHS's optional
// transformer over it to pick up anything special it wants to
// do:
const fact = rhsTransformer(self.rhs.fact(leftFnode, leftType));
self.lhs.checkFact(fact);
const rightFnode = ruleset.fnodeForElement(fact.element || leftFnode.element);
// If the RHS doesn't specify a type, default to the
// type of the LHS, if any:
const rightType = fact.type || self.lhs.guaranteedType();
if (fact.score !== undefined) {
if (rightType !== undefined) {
rightFnode.addScoreFor(rightType, fact.score, self.name);
} else {
throw new Error(`The right-hand side of a rule specified a score (${fact.score}) with neither an explicit type nor one we could infer from the left-hand side.`);
}
}
if (fact.type !== undefined || fact.note !== undefined) {
// There's a reason to call setNoteFor.
if (rightType === undefined) {
throw new Error(`The right-hand side of a rule specified a note (${fact.note}) with neither an explicit type nor one we could infer from the left-hand side. Notes are per-type, per-node, so that's a problem.`);
} else {
rightFnode.setNoteFor(rightType, fact.note);
}
}
returnedFnodes.add(rightFnode);
},