AssertValidMutableRanges.ts — react Source File
Architecture documentation for AssertValidMutableRanges.ts, a typescript file in the react codebase. 11 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR e7df7f8d_b353_72bb_43cf_c01001ed97b5["AssertValidMutableRanges.ts"] a451512c_09d1_62a9_9849_56979af31473["HIR.ts"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> a451512c_09d1_62a9_9849_56979af31473 894425f7_6a57_9e72_e74a_99970e6733dc["HIRFunction"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 894425f7_6a57_9e72_e74a_99970e6733dc d73757b2_9a27_191a_2c1b_9326d34b4f07["MutableRange"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> d73757b2_9a27_191a_2c1b_9326d34b4f07 29e6d9f5_d4e0_0ab4_bd10_4d8be0a9cdb8["Place"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 29e6d9f5_d4e0_0ab4_bd10_4d8be0a9cdb8 d9b2aef1_81c1_3c22_a001_2fd7fcc95ecb["visitors.ts"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> d9b2aef1_81c1_3c22_a001_2fd7fcc95ecb 9050415e_479c_c9d6_757c_555d4b4d39dc["eachInstructionLValue"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 9050415e_479c_c9d6_757c_555d4b4d39dc 6e1ebdb8_441d_b6d1_1537_2c5ba936ec85["eachInstructionOperand"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 6e1ebdb8_441d_b6d1_1537_2c5ba936ec85 0c50ce68_890c_c51a_28a0_cda17c2c15fb["eachTerminalOperand"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 0c50ce68_890c_c51a_28a0_cda17c2c15fb 911671da_f209_22ee_2f71_4b0c94946a53["PrintHIR.ts"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 911671da_f209_22ee_2f71_4b0c94946a53 b8fc6a90_4e66_69af_f5d9_b6822409f09f["printPlace"] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> b8fc6a90_4e66_69af_f5d9_b6822409f09f 136fe9f0_06da_44e5_23a1_8604eccbbf07[".."] e7df7f8d_b353_72bb_43cf_c01001ed97b5 --> 136fe9f0_06da_44e5_23a1_8604eccbbf07 style e7df7f8d_b353_72bb_43cf_c01001ed97b5 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 {HIRFunction, MutableRange, Place} from './HIR';
import {
eachInstructionLValue,
eachInstructionOperand,
eachTerminalOperand,
} from './visitors';
import {CompilerError} from '..';
import {printPlace} from './PrintHIR';
/*
* Checks that all mutable ranges in the function are well-formed, with
* start === end === 0 OR end > start.
*/
export function assertValidMutableRanges(fn: HIRFunction): void {
for (const [, block] of fn.body.blocks) {
for (const phi of block.phis) {
visit(phi.place, `phi for block bb${block.id}`);
for (const [pred, operand] of phi.operands) {
visit(operand, `phi predecessor bb${pred} for block bb${block.id}`);
}
}
for (const instr of block.instructions) {
for (const operand of eachInstructionLValue(instr)) {
visit(operand, `instruction [${instr.id}]`);
}
for (const operand of eachInstructionOperand(instr)) {
visit(operand, `instruction [${instr.id}]`);
}
}
for (const operand of eachTerminalOperand(block.terminal)) {
visit(operand, `terminal [${block.terminal.id}]`);
}
}
}
function visit(place: Place, description: string): void {
validateMutableRange(place, place.identifier.mutableRange, description);
if (place.identifier.scope !== null) {
validateMutableRange(place, place.identifier.scope.range, description);
}
}
function validateMutableRange(
place: Place,
range: MutableRange,
description: string,
): void {
CompilerError.invariant(
(range.start === 0 && range.end === 0) || range.end > range.start,
{
reason: `Invalid mutable range: [${range.start}:${range.end}]`,
description: `${printPlace(place)} in ${description}`,
loc: place.loc,
},
);
}
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does AssertValidMutableRanges.ts do?
AssertValidMutableRanges.ts is a source file in the react codebase, written in typescript. It belongs to the StaticAnalysis domain, TypeInference subdomain.
What functions are defined in AssertValidMutableRanges.ts?
AssertValidMutableRanges.ts defines 3 function(s): assertValidMutableRanges, validateMutableRange, visit.
What does AssertValidMutableRanges.ts depend on?
AssertValidMutableRanges.ts imports 11 module(s): .., HIR.ts, HIRFunction, MutableRange, Place, PrintHIR.ts, eachInstructionLValue, eachInstructionOperand, and 3 more.
Where is AssertValidMutableRanges.ts in the architecture?
AssertValidMutableRanges.ts is located at compiler/packages/babel-plugin-react-compiler/src/HIR/AssertValidMutableRanges.ts (domain: StaticAnalysis, subdomain: TypeInference, directory: compiler/packages/babel-plugin-react-compiler/src/HIR).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free