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
  2127ea1b_a77c_06dc_8c70_cd0ff98cb1ca["checkExpression()"]
  2d4ea1fb_ca3b_f5fc_5e5f_57270428b446["error-detector.ts"]
  2127ea1b_a77c_06dc_8c70_cd0ff98cb1ca -->|defined in| 2d4ea1fb_ca3b_f5fc_5e5f_57270428b446
  5fc4a59d_bcb9_be4d_570f_a7dcdb348719["checkNode()"]
  5fc4a59d_bcb9_be4d_570f_a7dcdb348719 -->|calls| 2127ea1b_a77c_06dc_8c70_cd0ff98cb1ca
  37baf005_61f0_9158_e058_dc71b1339824["checkEvent()"]
  37baf005_61f0_9158_e058_dc71b1339824 -->|calls| 2127ea1b_a77c_06dc_8c70_cd0ff98cb1ca
  8f94cca1_b281_78f0_327e_1f6ace002464["checkFor()"]
  8f94cca1_b281_78f0_327e_1f6ace002464 -->|calls| 2127ea1b_a77c_06dc_8c70_cd0ff98cb1ca
  style 2127ea1b_a77c_06dc_8c70_cd0ff98cb1ca 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