Validate property access
(
prop_access: &PropertyAccess,
ctx: &mut ValidationContext,
errors: &mut Vec<ValidationError>,
)
| 1879 | |
| 1880 | /// Validate property access |
| 1881 | fn validate_property_access( |
| 1882 | prop_access: &PropertyAccess, |
| 1883 | ctx: &mut ValidationContext, |
| 1884 | errors: &mut Vec<ValidationError>, |
| 1885 | ) { |
| 1886 | // Check if the object variable is declared |
| 1887 | if !ctx.declared_variables.contains(&prop_access.object) { |
| 1888 | // If we have graph context (from session or FROM clause), |
| 1889 | // variables will be resolved at runtime with the graph |
| 1890 | if !ctx.has_graph_context { |
| 1891 | errors.push(ValidationError { |
| 1892 | message: format!("Undefined variable '{}'", prop_access.object), |
| 1893 | location: None, |
| 1894 | error_type: ValidationErrorType::Semantic, |
| 1895 | }); |
| 1896 | } |
| 1897 | } |
| 1898 | |
| 1899 | // Validate property name syntax |
| 1900 | if prop_access.property.is_empty() { |
| 1901 | errors.push(ValidationError { |
| 1902 | message: "Property name cannot be empty".to_string(), |
| 1903 | location: None, |
| 1904 | error_type: ValidationErrorType::Syntax, |
| 1905 | }); |
| 1906 | } |
| 1907 | } |
| 1908 | |
| 1909 | /// Validate variable usage |
| 1910 | fn validate_variable_usage( |
no test coverage detected