AssertWellFormedBreakTargets.ts — react Source File
Architecture documentation for AssertWellFormedBreakTargets.ts, a typescript file in the react codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 31e1b13d_4465_d177_45eb_7f64bf27ed7e["AssertWellFormedBreakTargets.ts"] 0423f759_97e0_9101_4634_ed555abc5ca9["index.ts"] 31e1b13d_4465_d177_45eb_7f64bf27ed7e --> 0423f759_97e0_9101_4634_ed555abc5ca9 21609915_b03a_fd75_b58a_4cb86ef9315b["visitors.ts"] 31e1b13d_4465_d177_45eb_7f64bf27ed7e --> 21609915_b03a_fd75_b58a_4cb86ef9315b 171a5d22_bb6b_1c99_05a4_6ad897438a35["ReactiveFunctionVisitor"] 31e1b13d_4465_d177_45eb_7f64bf27ed7e --> 171a5d22_bb6b_1c99_05a4_6ad897438a35 2435b5f8_41a6_0458_ba88_4479b965455f["visitReactiveFunction"] 31e1b13d_4465_d177_45eb_7f64bf27ed7e --> 2435b5f8_41a6_0458_ba88_4479b965455f 2ed45bcd_6c82_3ccd_0e20_fa96b5111055[".."] 31e1b13d_4465_d177_45eb_7f64bf27ed7e --> 2ed45bcd_6c82_3ccd_0e20_fa96b5111055 style 31e1b13d_4465_d177_45eb_7f64bf27ed7e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {CompilerError} from '..';
import {BlockId, ReactiveFunction, ReactiveTerminalStatement} from '../HIR';
import {ReactiveFunctionVisitor, visitReactiveFunction} from './visitors';
/**
* Assert that all break/continue targets reference existent labels.
*/
export function assertWellFormedBreakTargets(fn: ReactiveFunction): void {
visitReactiveFunction(fn, new Visitor(), new Set());
}
class Visitor extends ReactiveFunctionVisitor<Set<BlockId>> {
override visitTerminal(
stmt: ReactiveTerminalStatement,
seenLabels: Set<BlockId>,
): void {
if (stmt.label != null) {
seenLabels.add(stmt.label.id);
}
const terminal = stmt.terminal;
if (terminal.kind === 'break' || terminal.kind === 'continue') {
CompilerError.invariant(seenLabels.has(terminal.target), {
reason: 'Unexpected break to invalid label',
loc: stmt.terminal.loc,
});
}
}
}
Domain
Subdomains
Functions
Classes
Source
Frequently Asked Questions
What does AssertWellFormedBreakTargets.ts do?
AssertWellFormedBreakTargets.ts is a source file in the react codebase, written in typescript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in AssertWellFormedBreakTargets.ts?
AssertWellFormedBreakTargets.ts defines 1 function(s): assertWellFormedBreakTargets.
What does AssertWellFormedBreakTargets.ts depend on?
AssertWellFormedBreakTargets.ts imports 5 module(s): .., ReactiveFunctionVisitor, index.ts, visitReactiveFunction, visitors.ts.
Where is AssertWellFormedBreakTargets.ts in the architecture?
AssertWellFormedBreakTargets.ts is located at compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes/AssertWellFormedBreakTargets.ts (domain: BabelCompiler, subdomain: Validation, directory: compiler/packages/babel-plugin-react-compiler/src/ReactiveScopes).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free