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

code-path.js — react Source File

Architecture documentation for code-path.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

'use strict';

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

// eslint-disable-next-line
const CodePathState = require('./code-path-state');
// eslint-disable-next-line
const IdGenerator = require('./id-generator');

//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------

/**
 * A code path.
 */
class CodePath {
  /**
   * Creates a new instance.
   * @param {Object} options Options for the function (see below).
   * @param {string} options.id An identifier.
   * @param {string} options.origin The type of code path origin.
   * @param {CodePath|null} options.upper The code path of the upper function scope.
   * @param {Function} options.onLooped A callback function to notify looping.
   */
  constructor({id, origin, upper, onLooped}) {
    /**
     * The identifier of this code path.
     * Rules use it to store additional information of each rule.
     * @type {string}
     */
    this.id = id;

    /**
     * The reason that this code path was started. May be "program",
     * "function", "class-field-initializer", or "class-static-block".
     * @type {string}
     */
    this.origin = origin;

    /**
     * The code path of the upper function scope.
     * @type {CodePath|null}
     */
    this.upper = upper;

    /**
     * The code paths of nested function scopes.
     * @type {CodePath[]}
     */
    this.childCodePaths = [];

    // Initializes internal state.
    Object.defineProperty(this, 'internal', {
      value: new CodePathState(new IdGenerator(`${id}_`), onLooped),
    });

    // Adds this into `childCodePaths` of `upper`.
// ... (180 more lines)

Domain

Subdomains

Classes

Frequently Asked Questions

What does code-path.js do?
code-path.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
Where is code-path.js in the architecture?
code-path.js is located at packages/eslint-plugin-react-hooks/src/code-path-analysis/code-path.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