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
  d804c097_af6f_a277_5941_3c14c48219ab["walkObjectPattern()"]
  c9346cac_54e3_f6ca_68a7_03c6e82c9609["compileScript.ts"]
  d804c097_af6f_a277_5941_3c14c48219ab -->|defined in| c9346cac_54e3_f6ca_68a7_03c6e82c9609
  3de0d66d_b49c_710a_a5dd_4aad647e8642["walkDeclaration()"]
  3de0d66d_b49c_710a_a5dd_4aad647e8642 -->|calls| d804c097_af6f_a277_5941_3c14c48219ab
  33d0b2df_a777_bd42_b608_b96585e579c0["walkPattern()"]
  33d0b2df_a777_bd42_b608_b96585e579c0 -->|calls| d804c097_af6f_a277_5941_3c14c48219ab
  15980fd6_fbc3_7a96_daca_3f054741f0e8["registerBinding()"]
  d804c097_af6f_a277_5941_3c14c48219ab -->|calls| 15980fd6_fbc3_7a96_daca_3f054741f0e8
  33d0b2df_a777_bd42_b608_b96585e579c0["walkPattern()"]
  d804c097_af6f_a277_5941_3c14c48219ab -->|calls| 33d0b2df_a777_bd42_b608_b96585e579c0
  style d804c097_af6f_a277_5941_3c14c48219ab 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