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
  b55383fd_0a74_e361_5034_d76e06d6bf2d["checkExpression()"]
  aaee210a_1630_b83a_6361_806f69707ec9["checkNode()"]
  aaee210a_1630_b83a_6361_806f69707ec9 -->|calls| b55383fd_0a74_e361_5034_d76e06d6bf2d
  963ab69f_336b_5da9_d203_6d251ae6120e["checkEvent()"]
  963ab69f_336b_5da9_d203_6d251ae6120e -->|calls| b55383fd_0a74_e361_5034_d76e06d6bf2d
  da6ee129_b19b_d0f1_26f1_e03a0847421e["checkFor()"]
  da6ee129_b19b_d0f1_26f1_e03a0847421e -->|calls| b55383fd_0a74_e361_5034_d76e06d6bf2d
  style b55383fd_0a74_e361_5034_d76e06d6bf2d 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.
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