Home / Function/ processExp() — vue Function Reference

processExp() — vue Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  8b0d9022_d61b_fac0_8496_8bd8ba5757a4["processExp()"]
  c9346cac_54e3_f6ca_68a7_03c6e82c9609["compileScript.ts"]
  8b0d9022_d61b_fac0_8496_8bd8ba5757a4 -->|defined in| c9346cac_54e3_f6ca_68a7_03c6e82c9609
  4bc89743_7d83_8a25_3b2c_4a23c4277478["resolveTemplateUsageCheckString()"]
  4bc89743_7d83_8a25_3b2c_4a23c4277478 -->|calls| 8b0d9022_d61b_fac0_8496_8bd8ba5757a4
  484ec320_49bc_b969_d86d_edc246af3234["walkIdentifiers()"]
  8b0d9022_d61b_fac0_8496_8bd8ba5757a4 -->|calls| 484ec320_49bc_b969_d86d_edc246af3234
  bca1d83e_8db5_fa8e_2047_b2a79f5c0251["stripStrings()"]
  8b0d9022_d61b_fac0_8496_8bd8ba5757a4 -->|calls| bca1d83e_8db5_fa8e_2047_b2a79f5c0251
  style 8b0d9022_d61b_fac0_8496_8bd8ba5757a4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/compiler-sfc/src/compileScript.ts lines 1841–1863

function processExp(exp: string, isTS: boolean, dir?: string): string {
  if (isTS && / as\s+\w|<.*>|:/.test(exp)) {
    if (dir === 'slot') {
      exp = `(${exp})=>{}`
    } else if (dir === 'on') {
      exp = `()=>{return ${exp}}`
    } else if (dir === 'for') {
      const inMatch = exp.match(forAliasRE)
      if (inMatch) {
        const [, LHS, RHS] = inMatch
        return processExp(`(${LHS})=>{}`, true) + processExp(RHS, true)
      }
    }
    let ret = ''
    // has potential type cast or generic arguments that uses types
    const ast = parseExpression(exp, { plugins: ['typescript'] })
    walkIdentifiers(ast, node => {
      ret += `,` + node.name
    })
    return ret
  }
  return stripStrings(exp)
}

Domain

Subdomains

Frequently Asked Questions

What does processExp() do?
processExp() is a function in the vue codebase, defined in packages/compiler-sfc/src/compileScript.ts.
Where is processExp() defined?
processExp() is defined in packages/compiler-sfc/src/compileScript.ts at line 1841.
What does processExp() call?
processExp() calls 2 function(s): stripStrings, walkIdentifiers.
What calls processExp()?
processExp() is called by 1 function(s): resolveTemplateUsageCheckString.

Analyze Your Own Codebase

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

Try Supermodel Free