Add a high-level API to extract an argument from a LabeledExprListSyntax
#2047
Labels
enhancement
New feature or request
A very common task for macros is to extract the argument for a specific function parameter. Instead of having each macro dig through the
LabeledExprListSyntax
, we should offer a high-level API that does this.Designing such an API will probably be non-trivial. Ideally, you pass it the signature of the function/macro parameters and it performs the parameter matching logic in the same way that the type checker does. This means, that the API will need to figure out how to match arguments to variadic parameters, how to handle defaulted parameters and how to handle parameter packs.
After we have implemented the parameter matching logic, we would need a way to query the match result. I think two queries that should at least be supported is to get the argument for a specific argument label and to get the arguments at a specific parameter index.
The text was updated successfully, but these errors were encountered: