MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / validate_searched_case_expression

Function validate_searched_case_expression

graphlite/src/ast/validator.rs:1270–1296  ·  view source on GitHub ↗

Validate searched CASE expressions

(
    searched_case: &SearchedCaseExpression,
    ctx: &mut ValidationContext,
    errors: &mut Vec<ValidationError>,
)

Source from the content-addressed store, hash-verified

1268
1269/// Validate searched CASE expressions
1270fn validate_searched_case_expression(
1271 searched_case: &SearchedCaseExpression,
1272 ctx: &mut ValidationContext,
1273 errors: &mut Vec<ValidationError>,
1274) {
1275 // Validate WHEN branches
1276 for when_branch in &searched_case.when_branches {
1277 // Validate WHEN condition
1278 validate_expression(&when_branch.condition, ctx, errors);
1279 // Validate THEN expression
1280 validate_expression(&when_branch.then_expression, ctx, errors);
1281 }
1282
1283 // Validate ELSE expression if present
1284 if let Some(else_expr) = &searched_case.else_expression {
1285 validate_expression(else_expr, ctx, errors);
1286 }
1287
1288 // Check that there's at least one WHEN branch
1289 if searched_case.when_branches.is_empty() {
1290 errors.push(ValidationError {
1291 message: "CASE expression must have at least one WHEN branch".to_string(),
1292 location: Some(crate::ast::Location::default()),
1293 error_type: ValidationErrorType::Structural,
1294 });
1295 }
1296}
1297
1298/// Validate PATH constructor expressions
1299fn validate_path_constructor(

Callers 1

validate_case_expressionFunction · 0.85

Calls 2

validate_expressionFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected