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
  8fa928f1_7d66_f996_7796_01a10820f019["walkPattern()"]
  9ae6652a_4e20_d88f_ad15_1cfe7add8cc2["walkObjectPattern()"]
  9ae6652a_4e20_d88f_ad15_1cfe7add8cc2 -->|calls| 8fa928f1_7d66_f996_7796_01a10820f019
  8745b835_f44b_f5b6_ddbf_501938820c46["walkArrayPattern()"]
  8745b835_f44b_f5b6_ddbf_501938820c46 -->|calls| 8fa928f1_7d66_f996_7796_01a10820f019
  72b07125_46f6_2586_ee42_1bdaa78eb7e2["registerBinding()"]
  8fa928f1_7d66_f996_7796_01a10820f019 -->|calls| 72b07125_46f6_2586_ee42_1bdaa78eb7e2
  9ae6652a_4e20_d88f_ad15_1cfe7add8cc2["walkObjectPattern()"]
  8fa928f1_7d66_f996_7796_01a10820f019 -->|calls| 9ae6652a_4e20_d88f_ad15_1cfe7add8cc2
  8745b835_f44b_f5b6_ddbf_501938820c46["walkArrayPattern()"]
  8fa928f1_7d66_f996_7796_01a10820f019 -->|calls| 8745b835_f44b_f5b6_ddbf_501938820c46
  style 8fa928f1_7d66_f996_7796_01a10820f019 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