Home / Function/ checkExpression() — vue Function Reference

checkExpression() — vue Function Reference

Architecture documentation for the checkExpression() function in error-detector.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  a07ee25d_c145_0205_5ce7_3eecf3bdb2c1["checkExpression()"]
  03e52bf5_d4b7_7913_0f75_08ec830fda42["checkNode()"]
  03e52bf5_d4b7_7913_0f75_08ec830fda42 -->|calls| a07ee25d_c145_0205_5ce7_3eecf3bdb2c1
  d8ead83e_af00_558d_c3d1_7e7216188655["checkEvent()"]
  d8ead83e_af00_558d_c3d1_7e7216188655 -->|calls| a07ee25d_c145_0205_5ce7_3eecf3bdb2c1
  ace53621_f03d_52e7_aefa_f706711cfd0f["checkFor()"]
  ace53621_f03d_52e7_aefa_f706711cfd0f -->|calls| a07ee25d_c145_0205_5ce7_3eecf3bdb2c1
  style a07ee25d_c145_0205_5ce7_3eecf3bdb2c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/compiler/error-detector.ts lines 113–140

function checkExpression(
  exp: string,
  text: string,
  warn: Function,
  range?: Range
) {
  try {
    new Function(`return ${exp}`)
  } catch (e: any) {
    const keywordMatch = exp
      .replace(stripStringRE, '')
      .match(prohibitedKeywordRE)
    if (keywordMatch) {
      warn(
        `avoid using JavaScript keyword as property name: ` +
          `"${keywordMatch[0]}"\n  Raw expression: ${text.trim()}`,
        range
      )
    } else {
      warn(
        `invalid expression: ${e.message} in\n\n` +
          `    ${exp}\n\n` +
          `  Raw expression: ${text.trim()}\n`,
        range
      )
    }
  }
}

Subdomains

Frequently Asked Questions

What does checkExpression() do?
checkExpression() is a function in the vue codebase.
What calls checkExpression()?
checkExpression() is called by 3 function(s): checkEvent, checkFor, checkNode.

Analyze Your Own Codebase

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

Try Supermodel Free