Validate unary operations
(
operator: &Operator,
expression: &Expression,
ctx: &mut ValidationContext,
errors: &mut Vec<ValidationError>,
)
| 1927 | |
| 1928 | /// Validate unary operations |
| 1929 | fn 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 |
| 1957 | fn validate_binary_operation( |
no test coverage detected