Home / Function/ walkObjectPattern() — vue Function Reference

walkObjectPattern() — vue Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

packages/compiler-sfc/src/compileScript.ts lines 1349–1375

function walkObjectPattern(
  node: ObjectPattern,
  bindings: Record<string, BindingTypes>,
  isConst: boolean,
  isDefineCall = false
) {
  for (const p of node.properties) {
    if (p.type === 'ObjectProperty') {
      if (p.key.type === 'Identifier' && p.key === p.value) {
        // shorthand: const { x } = ...
        const type = isDefineCall
          ? BindingTypes.SETUP_CONST
          : isConst
          ? BindingTypes.SETUP_MAYBE_REF
          : BindingTypes.SETUP_LET
        registerBinding(bindings, p.key, type)
      } else {
        walkPattern(p.value, bindings, isConst, isDefineCall)
      }
    } else {
      // ...rest
      // argument can only be identifier when destructuring
      const type = isConst ? BindingTypes.SETUP_CONST : BindingTypes.SETUP_LET
      registerBinding(bindings, p.argument as Identifier, type)
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free