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
  0f4b2d12_1485_be8c_d799_815c5d739d57["processExp()"]
  fac2f34b_3866_3537_2607_6622b0e848eb["resolveTemplateUsageCheckString()"]
  fac2f34b_3866_3537_2607_6622b0e848eb -->|calls| 0f4b2d12_1485_be8c_d799_815c5d739d57
  eb301be5_f530_960e_129f_798877ea7f83["walkIdentifiers()"]
  0f4b2d12_1485_be8c_d799_815c5d739d57 -->|calls| eb301be5_f530_960e_129f_798877ea7f83
  a8b0035b_637c_c5b5_2280_a543185e0d10["stripStrings()"]
  0f4b2d12_1485_be8c_d799_815c5d739d57 -->|calls| a8b0035b_637c_c5b5_2280_a543185e0d10
  style 0f4b2d12_1485_be8c_d799_815c5d739d57 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