ParameterAliasNodeTranslator causes QueryNodes to be re-created many times
While trying to write a class that rewrites OData semantic ASTs, I noticed that SingleValueFunctionCallNode.Properties was returning a different QueryNode instance for its first parameter each time it is accessed. This extra allocation is wasteful, and it can confuse tree rewriters that make decisions based on object reference equality. While debugging I found that the cause of this is the usage of .Select() in ParameterAliasNodeTranslator. This class should call .ToList() or .ToArray() to ensure that the lambdas are not re-evaluated repeatedly. Or perhaps the ToList()/.ToArray() call could go in the SingleValueFunctionCallNode constructor to prevent other bugs like this from happening in the future.
Assemblies affected
WebAPI OData latest
Reproduce steps
Create a FilterQueryOption for an expression like geo.intersects(location, geography'POLYGON((1 2, 2 3, 3 4, 1 2))'). Observe that every time you access SingleValueFunctionCallNode.Parameters, it returns a different SingleValuePropertyAccessNode each time.
Expected result
SingleValueFunctionCallNode.Parameters should return the exact same QueryNode objects each time it is accessed.
Actual result
Different parameter objects are returned each time.