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

Function validate_binary_operation

graphlite/src/ast/validator.rs:1957–2017  ·  view source on GitHub ↗

Validate binary operations

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

Source from the content-addressed store, hash-verified

1955
1956/// Validate binary operations
1957fn validate_binary_operation(
1958 operator: &Operator,
1959 left: &Expression,
1960 right: &Expression,
1961 ctx: &mut ValidationContext,
1962 errors: &mut Vec<ValidationError>,
1963) {
1964 // Validate that both operands are valid expressions
1965 validate_expression(left, ctx, errors);
1966 validate_expression(right, ctx, errors);
1967
1968 // Type compatibility checks (simplified)
1969 match operator {
1970 // Arithmetic operators
1971 Operator::Plus
1972 | Operator::Minus
1973 | Operator::Star
1974 | Operator::Slash
1975 | Operator::Percent
1976 | Operator::Caret => {
1977 // These require numeric types
1978 }
1979 // Comparison operators
1980 Operator::Equal
1981 | Operator::NotEqual
1982 | Operator::LessThan
1983 | Operator::LessEqual
1984 | Operator::GreaterThan
1985 | Operator::GreaterEqual => {
1986 // These can work with comparable types
1987 }
1988 // Logical operators
1989 Operator::And | Operator::Or | Operator::Not | Operator::Xor => {
1990 // These require boolean operands
1991 }
1992 // String operators
1993 Operator::In
1994 | Operator::NotIn
1995 | Operator::Contains
1996 | Operator::Starts
1997 | Operator::Ends
1998 | Operator::Like
1999 | Operator::Matches
2000 | Operator::FuzzyEqual
2001 | Operator::Concat => {
2002 // These require string operands (Concat converts non-strings to strings)
2003 }
2004 // Existence operator
2005 Operator::Exists => {
2006 // This is for checking existence
2007 }
2008 // Regex operator
2009 Operator::Regex => {
2010 // This requires string operands
2011 }
2012 // Temporal operator
2013 Operator::Within => {
2014 // This is for temporal operations

Callers 1

validate_expressionFunction · 0.85

Calls 1

validate_expressionFunction · 0.85

Tested by

no test coverage detected