refactor: add inline function step to replace functions after parsing #308
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.
Description
Adds a temporary step when parsing functions. We first gather all the function calls and parses them as InlineFunctionCall, when we have gathered all the calls we replace them.
This is to support custom functions, where order of calls doesn't matter, so we first need to know all function definitions before we can replace them.
See #309 for more context on custom function implentation.
Most of the changes are due to changing the expression builder method
What to review
I introduced a walk method to walk the AST, however this might be slow on very large queries. Is this an issue? 🤔 Another approach would be to store a reference(or similar) to each InlineFunctionCall, and then only replace the node's values.
Testing
Did not add any tests, as this doesn't change any behavior and only refactors to be compatible with custom groq functions