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
  d1f8290b_acd6_6448_2aa7_1bc8ba241901["processExp()"]
  cb40d1fd_2ff1_986b_17b9_664308ced21f["resolveTemplateUsageCheckString()"]
  cb40d1fd_2ff1_986b_17b9_664308ced21f -->|calls| d1f8290b_acd6_6448_2aa7_1bc8ba241901
  89db3100_db23_2ba5_52ae_1299b220043a["walkIdentifiers()"]
  d1f8290b_acd6_6448_2aa7_1bc8ba241901 -->|calls| 89db3100_db23_2ba5_52ae_1299b220043a
  08650dbf_9d96_f507_eab5_2cea0d207c0b["stripStrings()"]
  d1f8290b_acd6_6448_2aa7_1bc8ba241901 -->|calls| 08650dbf_9d96_f507_eab5_2cea0d207c0b
  style d1f8290b_acd6_6448_2aa7_1bc8ba241901 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.
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