Home / Function/ walkPattern() — vue Function Reference

walkPattern() — vue Function Reference

Architecture documentation for the walkPattern() function in compileScript.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  b97e494f_1fba_2a98_cbf7_83021486f017["walkPattern()"]
  bfce8178_fe0e_be86_22d0_21dd57e5cd01["walkObjectPattern()"]
  bfce8178_fe0e_be86_22d0_21dd57e5cd01 -->|calls| b97e494f_1fba_2a98_cbf7_83021486f017
  5cc66cf3_fd40_8410_f4d0_169054819e55["walkArrayPattern()"]
  5cc66cf3_fd40_8410_f4d0_169054819e55 -->|calls| b97e494f_1fba_2a98_cbf7_83021486f017
  64256cf8_3f72_4dd0_8aab_f5daed1e921e["registerBinding()"]
  b97e494f_1fba_2a98_cbf7_83021486f017 -->|calls| 64256cf8_3f72_4dd0_8aab_f5daed1e921e
  bfce8178_fe0e_be86_22d0_21dd57e5cd01["walkObjectPattern()"]
  b97e494f_1fba_2a98_cbf7_83021486f017 -->|calls| bfce8178_fe0e_be86_22d0_21dd57e5cd01
  5cc66cf3_fd40_8410_f4d0_169054819e55["walkArrayPattern()"]
  b97e494f_1fba_2a98_cbf7_83021486f017 -->|calls| 5cc66cf3_fd40_8410_f4d0_169054819e55
  style b97e494f_1fba_2a98_cbf7_83021486f017 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/compiler-sfc/src/compileScript.ts lines 1388–1421

function walkPattern(
  node: Node,
  bindings: Record<string, BindingTypes>,
  isConst: boolean,
  isDefineCall = false
) {
  if (node.type === 'Identifier') {
    const type = isDefineCall
      ? BindingTypes.SETUP_CONST
      : isConst
      ? BindingTypes.SETUP_MAYBE_REF
      : BindingTypes.SETUP_LET
    registerBinding(bindings, node, type)
  } else if (node.type === 'RestElement') {
    // argument can only be identifier when destructuring
    const type = isConst ? BindingTypes.SETUP_CONST : BindingTypes.SETUP_LET
    registerBinding(bindings, node.argument as Identifier, type)
  } else if (node.type === 'ObjectPattern') {
    walkObjectPattern(node, bindings, isConst)
  } else if (node.type === 'ArrayPattern') {
    walkArrayPattern(node, bindings, isConst)
  } else if (node.type === 'AssignmentPattern') {
    if (node.left.type === 'Identifier') {
      const type = isDefineCall
        ? BindingTypes.SETUP_CONST
        : isConst
        ? BindingTypes.SETUP_MAYBE_REF
        : BindingTypes.SETUP_LET
      registerBinding(bindings, node.left, type)
    } else {
      walkPattern(node.left, bindings, isConst)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does walkPattern() do?
walkPattern() is a function in the vue codebase.
What does walkPattern() call?
walkPattern() calls 3 function(s): registerBinding, walkArrayPattern, walkObjectPattern.
What calls walkPattern()?
walkPattern() is called by 2 function(s): walkArrayPattern, walkObjectPattern.

Analyze Your Own Codebase

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

Try Supermodel Free