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
  33d0b2df_a777_bd42_b608_b96585e579c0["walkPattern()"]
  c9346cac_54e3_f6ca_68a7_03c6e82c9609["compileScript.ts"]
  33d0b2df_a777_bd42_b608_b96585e579c0 -->|defined in| c9346cac_54e3_f6ca_68a7_03c6e82c9609
  d804c097_af6f_a277_5941_3c14c48219ab["walkObjectPattern()"]
  d804c097_af6f_a277_5941_3c14c48219ab -->|calls| 33d0b2df_a777_bd42_b608_b96585e579c0
  774c7e5e_c2d4_464c_bba6_7ec6c9917c21["walkArrayPattern()"]
  774c7e5e_c2d4_464c_bba6_7ec6c9917c21 -->|calls| 33d0b2df_a777_bd42_b608_b96585e579c0
  15980fd6_fbc3_7a96_daca_3f054741f0e8["registerBinding()"]
  33d0b2df_a777_bd42_b608_b96585e579c0 -->|calls| 15980fd6_fbc3_7a96_daca_3f054741f0e8
  d804c097_af6f_a277_5941_3c14c48219ab["walkObjectPattern()"]
  33d0b2df_a777_bd42_b608_b96585e579c0 -->|calls| d804c097_af6f_a277_5941_3c14c48219ab
  774c7e5e_c2d4_464c_bba6_7ec6c9917c21["walkArrayPattern()"]
  33d0b2df_a777_bd42_b608_b96585e579c0 -->|calls| 774c7e5e_c2d4_464c_bba6_7ec6c9917c21
  style 33d0b2df_a777_bd42_b608_b96585e579c0 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, defined in packages/compiler-sfc/src/compileScript.ts.
Where is walkPattern() defined?
walkPattern() is defined in packages/compiler-sfc/src/compileScript.ts at line 1388.
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