Home / File/ code-path-analyzer.js — react Source File

code-path-analyzer.js — react Source File

Architecture documentation for code-path-analyzer.js, a javascript file in the react codebase. 0 imports, 1 dependents.

File javascript BabelCompiler Validation 1 dependents 14 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f["code-path-analyzer.js"]
  47fb9f02_49dd_1d0d_5027_9353a6a77f1e["RulesOfHooks.ts"]
  47fb9f02_49dd_1d0d_5027_9353a6a77f1e --> 09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f
  style 09a1c78a_21af_9be8_1cc6_22cf0ceb9f8f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

'use strict';

/* eslint-disable react-internal/no-primitive-constructors */

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

// eslint-disable-next-line
const assert = require('./assert');
// eslint-disable-next-line
const CodePath = require('./code-path');
// eslint-disable-next-line
const CodePathSegment = require('./code-path-segment');
// eslint-disable-next-line
const IdGenerator = require('./id-generator');

const breakableTypePattern =
  /^(?:(?:Do)?While|For(?:In|Of)?|Switch)Statement$/u;

//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------

/**
 * Checks whether or not a given node is a `case` node (not `default` node).
 * @param {ASTNode} node A `SwitchCase` node to check.
 * @returns {boolean} `true` if the node is a `case` node (not `default` node).
 */
function isCaseNode(node) {
  return Boolean(node.test);
}

/**
 * Checks if a given node appears as the value of a PropertyDefinition node.
 * @param {ASTNode} node THe node to check.
 * @returns {boolean} `true` if the node is a PropertyDefinition value,
 *      false if not.
 */
function isPropertyDefinitionValue(node) {
  const parent = node.parent;

  return (
    parent && parent.type === 'PropertyDefinition' && parent.value === node
  );
}

/**
 * Checks whether the given logical operator is taken into account for the code
 * path analysis.
 * @param {string} operator The operator found in the LogicalExpression node
 * @returns {boolean} `true` if the operator is "&&" or "||" or "??"
 */
function isHandledLogicalOperator(operator) {
  return operator === '&&' || operator === '||' || operator === '??';
}

/**
 * Checks whether the given assignment operator is a logical assignment operator.
 * Logical assignments are taken into account for the code path analysis
// ... (743 more lines)

Domain

Subdomains

Frequently Asked Questions

What does code-path-analyzer.js do?
code-path-analyzer.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in code-path-analyzer.js?
code-path-analyzer.js defines 14 function(s): forwardCurrentToHead, getBooleanValueIfSimpleConstant, getLabel, isCaseNode, isForkingByTrueOrFalse, isHandledLogicalOperator, isIdentifierReference, isLogicalAssignmentOperator, isPropertyDefinitionValue, leaveFromCurrentSegment, and 4 more.
What files import code-path-analyzer.js?
code-path-analyzer.js is imported by 1 file(s): RulesOfHooks.ts.
Where is code-path-analyzer.js in the architecture?
code-path-analyzer.js is located at packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path-analyzer.js (domain: BabelCompiler, subdomain: Validation, directory: packages/eslint-plugin-react-hooks/src/code-path-analysis).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free