makeFinallyBlock() — react Function Reference
Architecture documentation for the makeFinallyBlock() function in code-path-state.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD fe72461c_79f6_2f70_143a_d0976fabdb0c["makeFinallyBlock()"] d3cee22c_5e2d_f853_c075_2c7c55e5d22c["CodePathState"] fe72461c_79f6_2f70_143a_d0976fabdb0c -->|defined in| d3cee22c_5e2d_f853_c075_2c7c55e5d22c 4581c407_1b84_6f80_c60d_80725b7a3917["popForkContext()"] fe72461c_79f6_2f70_143a_d0976fabdb0c -->|calls| 4581c407_1b84_6f80_c60d_80725b7a3917 fcc7c411_4c84_b9a2_79b5_df3d388d50fc["pushForkContext()"] fe72461c_79f6_2f70_143a_d0976fabdb0c -->|calls| fcc7c411_4c84_b9a2_79b5_df3d388d50fc style fe72461c_79f6_2f70_143a_d0976fabdb0c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js lines 864–914
makeFinallyBlock() {
const context = this.tryContext;
let forkContext = this.forkContext;
const returned = context.returnedForkContext;
const thrown = context.thrownForkContext;
const headOfLeavingSegments = forkContext.head;
// Update state.
if (context.position === 'catch') {
// Merges two paths from the `try` block and `catch` block.
this.popForkContext();
forkContext = this.forkContext;
context.lastOfCatchIsReachable = forkContext.reachable;
} else {
context.lastOfTryIsReachable = forkContext.reachable;
}
context.position = 'finally';
if (returned.empty && thrown.empty) {
// This path does not leave.
return;
}
/*
* Create a parallel segment from merging returned and thrown.
* This segment will leave at the end of this finally block.
*/
const segments = forkContext.makeNext(-1, -1);
for (let i = 0; i < forkContext.count; ++i) {
const prevSegsOfLeavingSegment = [headOfLeavingSegments[i]];
for (let j = 0; j < returned.segmentsList.length; ++j) {
prevSegsOfLeavingSegment.push(returned.segmentsList[j][i]);
}
for (let j = 0; j < thrown.segmentsList.length; ++j) {
prevSegsOfLeavingSegment.push(thrown.segmentsList[j][i]);
}
segments.push(
CodePathSegment.newNext(
this.idGenerator.next(),
prevSegsOfLeavingSegment,
),
);
}
this.pushForkContext(true);
this.forkContext.add(segments);
}
Domain
Subdomains
Source
Frequently Asked Questions
What does makeFinallyBlock() do?
makeFinallyBlock() is a function in the react codebase, defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js.
Where is makeFinallyBlock() defined?
makeFinallyBlock() is defined in packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-state.js at line 864.
What does makeFinallyBlock() call?
makeFinallyBlock() calls 2 function(s): popForkContext, pushForkContext.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free