makeLogicalRight() — react Function Reference
Architecture documentation for the makeLogicalRight() function in code-path-state.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3baa501e_7ce6_0b8a_6f79_b6010731c7dd["makeLogicalRight()"] d3cee22c_5e2d_f853_c075_2c7c55e5d22c["CodePathState"] 3baa501e_7ce6_0b8a_6f79_b6010731c7dd -->|defined in| d3cee22c_5e2d_f853_c075_2c7c55e5d22c a005d725_0117_8f56_093b_9ace7fedb1cd["makeOptionalRight()"] a005d725_0117_8f56_093b_9ace7fedb1cd -->|calls| 3baa501e_7ce6_0b8a_6f79_b6010731c7dd style 3baa501e_7ce6_0b8a_6f79_b6010731c7dd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js lines 450–501
makeLogicalRight() {
const context = this.choiceContext;
const forkContext = this.forkContext;
if (context.processed) {
/*
* This got segments already from the child choice context.
* Creates the next path from own true/false fork context.
*/
let prevForkContext;
switch (context.kind) {
case '&&': // if true then go to the right-hand side.
prevForkContext = context.trueForkContext;
break;
case '||': // if false then go to the right-hand side.
prevForkContext = context.falseForkContext;
break;
case '??': // Both true/false can short-circuit, so needs the third path to go to the right-hand side. That's qqForkContext.
prevForkContext = context.qqForkContext;
break;
default:
throw new Error('unreachable');
}
forkContext.replaceHead(prevForkContext.makeNext(0, -1));
prevForkContext.clear();
context.processed = false;
} else {
/*
* This did not get segments from the child choice context.
* So addresses the head segments.
* The head segments are the path of the left-hand operand.
*/
switch (context.kind) {
case '&&': // the false path can short-circuit.
context.falseForkContext.add(forkContext.head);
break;
case '||': // the true path can short-circuit.
context.trueForkContext.add(forkContext.head);
break;
case '??': // both can short-circuit.
context.trueForkContext.add(forkContext.head);
context.falseForkContext.add(forkContext.head);
break;
default:
throw new Error('unreachable');
}
forkContext.replaceHead(forkContext.makeNext(-1, -1));
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does makeLogicalRight() do?
makeLogicalRight() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js.
Where is makeLogicalRight() defined?
makeLogicalRight() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js at line 450.
What calls makeLogicalRight()?
makeLogicalRight() is called by 1 function(s): makeOptionalRight.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free