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

Function validate_unary_operation

graphlite/src/ast/validator.rs:1929–1954  ·  view source on GitHub ↗

Validate unary operations

(
    operator: &Operator,
    expression: &Expression,
    ctx: &mut ValidationContext,
    errors: &mut Vec<ValidationError>,
)

Source from the content-addressed store, hash-verified

1927
1928/// Validate unary operations
1929fn validate_unary_operation(
1930 operator: &Operator,
1931 expression: &Expression,
1932 ctx: &mut ValidationContext,
1933 errors: &mut Vec<ValidationError>,
1934) {
1935 // Validate that the operand is a valid expression
1936 validate_expression(expression, ctx, errors);
1937
1938 // Type compatibility checks for unary operators
1939 match operator {
1940 Operator::Not => {
1941 // NOT requires boolean operand
1942 }
1943 Operator::Minus => {
1944 // Unary minus requires numeric operand
1945 }
1946 _ => {
1947 errors.push(ValidationError {
1948 message: format!("Invalid unary operator '{:?}'", operator),
1949 location: None,
1950 error_type: ValidationErrorType::Type,
1951 });
1952 }
1953 }
1954}
1955
1956/// Validate binary operations
1957fn validate_binary_operation(

Callers 1

validate_expressionFunction · 0.85

Calls 1

validate_expressionFunction · 0.85

Tested by

no test coverage detected