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
  16af5098_ed3e_ff8b_033a_83bfef03c28a["checkExpression()"]
  082d4686_2778_e118_a80c_c4ffc89177dc["error-detector.ts"]
  16af5098_ed3e_ff8b_033a_83bfef03c28a -->|defined in| 082d4686_2778_e118_a80c_c4ffc89177dc
  90b3f438_ac24_92d6_a5de_89063016d3c3["checkNode()"]
  90b3f438_ac24_92d6_a5de_89063016d3c3 -->|calls| 16af5098_ed3e_ff8b_033a_83bfef03c28a
  dd3e74a7_0a97_f4de_00bd_a2dd582148b6["checkEvent()"]
  dd3e74a7_0a97_f4de_00bd_a2dd582148b6 -->|calls| 16af5098_ed3e_ff8b_033a_83bfef03c28a
  4dd3d0a2_6743_9355_edda_f6ccca131e23["checkFor()"]
  4dd3d0a2_6743_9355_edda_f6ccca131e23 -->|calls| 16af5098_ed3e_ff8b_033a_83bfef03c28a
  style 16af5098_ed3e_ff8b_033a_83bfef03c28a 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
      )
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does checkExpression() do?
checkExpression() is a function in the vue codebase, defined in src/compiler/error-detector.ts.
Where is checkExpression() defined?
checkExpression() is defined in src/compiler/error-detector.ts at line 113.
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