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
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f["walkObjectPattern()"]
  b9f12a63_b611_1b00_0717_3ff21d7ce156["compileScript.ts"]
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f -->|defined in| b9f12a63_b611_1b00_0717_3ff21d7ce156
  b5dd2b92_1eb8_9be8_c96d_7d157359d180["walkDeclaration()"]
  b5dd2b92_1eb8_9be8_c96d_7d157359d180 -->|calls| d6ab12f6_4277_5388_3a07_cb9ebe239e5f
  00c89232_fbdd_01fc_cdd0_ea1524e7952b["walkPattern()"]
  00c89232_fbdd_01fc_cdd0_ea1524e7952b -->|calls| d6ab12f6_4277_5388_3a07_cb9ebe239e5f
  728798bd_d0a3_3f87_32eb_839c83a9e416["registerBinding()"]
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f -->|calls| 728798bd_d0a3_3f87_32eb_839c83a9e416
  00c89232_fbdd_01fc_cdd0_ea1524e7952b["walkPattern()"]
  d6ab12f6_4277_5388_3a07_cb9ebe239e5f -->|calls| 00c89232_fbdd_01fc_cdd0_ea1524e7952b
  style d6ab12f6_4277_5388_3a07_cb9ebe239e5f 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, defined in packages/compiler-sfc/src/compileScript.ts.
Where is walkObjectPattern() defined?
walkObjectPattern() is defined in packages/compiler-sfc/src/compileScript.ts at line 1349.
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