✨ feat: implement paren-free function calls and update documentation#1717
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements “paren-free” function invocation in pipeline position in mq-lang, allowing bare identifiers (and qualified accesses) that resolve to 0- or 1-required-parameter functions to be auto-called, and adds documentation + tests to cover the new behavior.
Changes:
- Add evaluator support to auto-call user-defined and builtin functions when a pipeline step is a bare identifier / qualified access.
- Add integration and evaluator tests covering paren-free calls (user functions, builtins, chaining, and qualified access cases).
- Document the new paren-free calling behavior in the reference docs.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/books/src/reference/functions.md | Adds reference documentation for parenthesis-free calls in pipeline position. |
| crates/mq-lang/tests/integration_tests.rs | Adds integration tests covering paren-free calls across user-defined functions, builtins, chaining, and “function as value” cases. |
| crates/mq-lang/src/eval.rs | Implements the auto-call logic in the evaluator and adds unit tests for qualified-access paren-free calls. |
Comment on lines
+152
to
+153
| - A **0-argument function** invoked without `()` is called with no explicit arguments. | ||
| - A **1-argument function** invoked without `()` receives the current pipeline value as its implicit argument. |
Comment on lines
+469
to
+475
| fn maybe_auto_call_pipeline_ident( | ||
| &mut self, | ||
| value: RuntimeValue, | ||
| runtime_value: &RuntimeValue, | ||
| expr: &Shared<ast::Node>, | ||
| env: &Shared<SharedCell<Env>>, | ||
| ) -> EvalResult { |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…thub.com/harehare/mq into feat/implement-paren-free-function-calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.