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
  00c89232_fbdd_01fc_cdd0_ea1524e7952b["walkPattern()"]
  b9f12a63_b611_1b00_0717_3ff21d7ce156["compileScript.ts"]
  00c89232_fbdd_01fc_cdd0_ea1524e7952b -->|defined in| b9f12a63_b611_1b00_0717_3ff21d7ce156
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f["walkObjectPattern()"]
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f -->|calls| 00c89232_fbdd_01fc_cdd0_ea1524e7952b
  f1063681_e6da_d3c4_2c08_889e677edbc4["walkArrayPattern()"]
  f1063681_e6da_d3c4_2c08_889e677edbc4 -->|calls| 00c89232_fbdd_01fc_cdd0_ea1524e7952b
  728798bd_d0a3_3f87_32eb_839c83a9e416["registerBinding()"]
  00c89232_fbdd_01fc_cdd0_ea1524e7952b -->|calls| 728798bd_d0a3_3f87_32eb_839c83a9e416
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f["walkObjectPattern()"]
  00c89232_fbdd_01fc_cdd0_ea1524e7952b -->|calls| d6ab12f6_4277_5388_3a07_cb9ebe239e5f
  f1063681_e6da_d3c4_2c08_889e677edbc4["walkArrayPattern()"]
  00c89232_fbdd_01fc_cdd0_ea1524e7952b -->|calls| f1063681_e6da_d3c4_2c08_889e677edbc4
  style 00c89232_fbdd_01fc_cdd0_ea1524e7952b 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