-
-
Notifications
You must be signed in to change notification settings - Fork 414
Expand the key API to allow for nested keys #8243
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
base: dev/feature
Are you sure you want to change the base?
Conversation
APickledWalrus
left a comment
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.
seems ok overall just a couple thoughts
APickledWalrus
left a comment
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.
Just about ready
| * @throws IllegalStateException if this parameter does not have a default value | ||
| * @see #evaluate(Expression, Event) | ||
| */ | ||
| public Object[] evaluateDefault(Event event) { |
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 methods need param docs. Also, does this method really need to exist if passing null to evaluate does the same thing?
| @Override | ||
| public @NotNull String @NotNull [] getArrayKeys(Event event) throws IllegalStateException { | ||
| if (!returnsKeys) | ||
| throw new IllegalStateException(); |
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.
UnsupportedOperationException might fit better? idk
Problem
There are a few issues that this PR aims to address. Most notably, there is currently no straightforward way to pass entire list structures around. The other issues consist of a couple of minor bugs introduced by the previous PR.
foo(keyed {_list1::*}, keyed {_list2::*})wherelist1andlist2both contain values corresponding to the same key) would throw an exception.Solution
This PR introduces new method to get an expression's values recursively, along with a corresponding
recursiveexpression that makes use of that behavior. When combined with thekeyedexpression, it allows both keys and values to be returned recursively, allowing entire structures to passed around seamlessly between different contexts.Addressing the aforementioned issues:
Parameterclass that evaluates expressions with respect to the parameter's modifiers. This unfortunately makes Fix function parameters with default value as list causing error #8221 obsolete.Testing Completed
StructFunction.sk,ExprRecursive.skSupporting Information
Below is a complete example showing how various combinations behave:
Using functions:
Completes: #8220
Related: none