microsoft / Power-Fx

Power Fx low-code programming language
MIT License
3.14k stars 309 forks source link

Get a list of all called functions in an expression #2455

Closed anderson-joyle closed 2 weeks ago

anderson-joyle commented 3 weeks ago

New API to get a list of all called functions in an expression. Maybe ParseResults.GetListOfCalledFunctions(). Expression: With({x:Abs(First(table).field)}, Abs(x-y)) Result: ["With", "Abs", "First", "Abs"]

MikeStall commented 2 weeks ago

This should hang off CheckResult, similalar to TopLevelIdentiifers.

If we just want function names, we can get from parser:

IEnumerable CheckResult.GetFunctionNames() Very similar to what we already do with TopLevel identifiers. This can succeed after ApplyParse() and skip binding.

If we want binding... we should return these: https://github.com/microsoft/Power-Fx/blob/main/src/libraries/Microsoft.PowerFx.Core/Public/Reflection/FunctionInfo.cs

IEnumerable CheckResult.GetFunctions()