-
-
Notifications
You must be signed in to change notification settings - Fork 118
feat(hql): Object creations #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for object and array creation syntax in the HQL (Helix Query Language) return statements. The change extends the language's ability to construct complex return types directly in queries.
- Adds new
ReturnType
enum to handle arrays, objects, and expressions in return statements - Implements parsing for array and object creation syntax in the grammar
- Updates code generation to handle the new return value types
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
test_simple.hx | Test file with incomplete expression |
helix-db/src/protocol/return_values.rs | Adds support for Vec conversion and removes unused code |
helix-db/src/helixc/parser/helix_parser.rs | Implements parsing for array/object creation with new ReturnType enum |
helix-db/src/helixc/generator/return_values.rs | Adds code generation for array and object return types |
helix-db/src/helixc/generator/queries.rs | Updates query generation with conditional parameter handling |
helix-db/src/helixc/analyzer/methods/query_validation.rs | Implements validation for new return types with recursive processing |
helix-db/src/helixc/analyzer/analyzer.rs | Updates analyzer to handle ReturnType enum changes |
helix-db/src/grammar.pest | Adds grammar rules for array_creation, object_creation, and related constructs |
Comments suppressed due to low confidence (1)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
_ => { | ||
objects.push(ReturnType::Object(self.parse_object_creation(p)?)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes all non-identifier rules are object_creation, which may not be correct. The code should explicitly match against Rule::object_creation and handle unexpected rules with an error.
_ => { | |
objects.push(ReturnType::Object(self.parse_object_creation(p)?)); | |
} | |
Rule::object_creation => { | |
objects.push(ReturnType::Object(self.parse_object_creation(p)?)); | |
} | |
_ => { | |
return Err(ParserError::from(format!( | |
"Unexpected rule in parse_array_creation: {:?}", | |
p.as_rule() | |
))); | |
} |
Copilot uses AI. Check for mistakes.
ReturnType::UnnamedExpr => todo!(), | ||
ReturnType::HashMap => todo!(), | ||
ReturnType::Array => todo!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These todo!() macros will cause runtime panics. Consider implementing these cases or returning a default value with a comment explaining the limitation.
ReturnType::UnnamedExpr => todo!(), | |
ReturnType::HashMap => todo!(), | |
ReturnType::Array => todo!(), | |
// These variants do not have an associated name; return a default value. | |
ReturnType::UnnamedExpr | ReturnType::HashMap | ReturnType::Array => "data".to_string(), |
Copilot uses AI. Check for mistakes.
Description
Related Issues
Closes #
Checklist when merging to main
rustfmt
helix-cli/Cargo.toml
andhelixdb/Cargo.toml
Additional Notes