Skip to content

Expression::CallResult does not provide a way to get the arguments used in the call #5407

@LegNeato

Description

@LegNeato

Is your feature request related to a problem? Please describe.
Expression::CallResult only contains a handle to a Function. That function has FunctionArgs, but they are the args that are defined in the function signature rather than the args for the function call.

This is not a problem for the backends that output strings as they can just output the function name and an open paren and hope that Expression::FunctionArguments or whatever come later. It is a problem for my Rust backend (#5175) as I need to make a complete syn item for the function call when I encounter an Expression::CallResult:

Ok(Expr::Call(ExprCall {
    attrs: vec![],
    func: Box::new(Expr::Path(ExprPath {
        attrs: vec![],
        qself: None,
        path: Path::from(Ident::new(
            &func.name.as_ref().expect("function has name"),
            Span::call_site(),
        )),
    })),
    paren_token: syn::token::Paren::default(),
    args: ????, // <------ Can't access anything to fill out here.
}))

Describe the solution you'd like
I'd like Expression::CallResult to also contain the list of argument expressions the function is being called with, similar to how Expression::Math works.

Happy to put up a PR if someone points me in the right direction.

Describe alternatives you've considered

  • Am I missing some way to do what I want?
  • I could store the current function being called in some way, though I am not sure how I would know it is over...perhaps when encountering a store?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions