@eagleoutice/flowr - v2.15.8
    Preparing search index...

    Variable MatchArgsConst

    MatchArgs: {
        findWithProps(
            this: void,
            args: readonly FunctionArgument[],
            signature: FnSig,
            props: number,
        ): NodeId[];
        formalsOf: <Info>(
            this: void,
            call: RFunctionCall<Info & ParentInformation>,
            graph: DataflowGraph,
            ctx: ReadOnlyFlowrAnalyzerContext,
        ) => readonly string[] | undefined;
        onCallAndLink(
            this: void,
            args: readonly FunctionArgument[],
            params: readonly RParameter<ParentInformation>[],
            graph: DataflowGraph,
        ): Map<NodeId, NodeId>;
        toDefinition<Info>(
            this: void,
            call: RFunctionCall<Info & ParentInformation>,
            graph: DataflowGraph,
            ctx: ReadOnlyFlowrAnalyzerContext,
        ): ReadonlyMap<string, RArgument<(...) & (...)>> | undefined;
        toNames<Info = object>(
            this: void,
            args: readonly PotentiallyEmptyRArgument<Info>[],
            paramNames: readonly string[],
        ): ReadonlyMap<string, RArgument<Info>>;
        toSpec<Targets extends NodeId = string>(
            this: void,
            args: readonly FunctionArgument[],
            params: Record<string, Targets> | readonly SigParameter[],
        ): Map<Targets, NodeId[]>;
    } = ...

    R's argument matching, as matchArgumentsToParameters implements it. Pick by what you hold:

    • toNames - AST arguments and the formal names
    • toSpec - graph arguments and the formals (a spec or a database signature)
    • onCallAndLink - as toSpec, and adds the argument edges to the graph
    • toDefinition - only the call, the formals are looked up for you
    • findWithProps - graph arguments and a built-in signature, keeping the ones used for given ArgProps

    Type Declaration

    • findWithProps: function
      • Find all arguments of a function call that have a given argument property using the function signature.

        Parameters

        • this: void
        • args: readonly FunctionArgument[]

          The function arguments as the graph holds them.

        • signature: FnSig

          The function signature whose names are the targets.

        • props: number

          The ArgProps the function arguments should have.

        Returns NodeId[]

        The value ids of the matching arguments.

    • formalsOf: <Info>(
          this: void,
          call: RFunctionCall<Info & ParentInformation>,
          graph: DataflowGraph,
          ctx: ReadOnlyFlowrAnalyzerContext,
      ) => readonly string[] | undefined

      The formal names a call binds against, whichever of flowR's sources knows them; see formalsOf.

    • toDefinition: function
      • Binds a call's arguments to the formals of whatever it calls, looking the formals up itself. It takes them from the RFunctionDefinition the call resolves to in user code, and from the database signature at the version the analysis assumes otherwise (see SignatureDb). undefined when it resolves to neither, so fall back to a hardcoded list then.

        graph is what says which definition a name reaches here, because scoping, shadowing and control flow decide that and a name alone cannot. It therefore needs a finished graph rather than one under construction. Cost is one Dataflow.origin lookup plus, for a package call, decoding that one function.

        Type Parameters

        • Info

        Parameters

        Returns ReadonlyMap<string, RArgument<(...) & (...)>> | undefined

        Per formal name the argument bound to it, undefined if the formals could not be found.

    • toNames: function
      • Binds a call's AST args to the formal paramNames. An empty argument (f(1, ,3)) takes its formal but never appears here. Arguments falling to ... share that key, so only the last survives; use MatchArgs.toSpec to keep them all.

        Type Parameters

        • Info = object

        Parameters

        • this: void
        • args: readonly PotentiallyEmptyRArgument<Info>[]

          The arguments as they stand in the normalized AST.

        • paramNames: readonly string[]

          The formals of the called function, in order.

        Returns ReadonlyMap<string, RArgument<Info>>

        Per formal name the argument bound to it.

        RFunctionCall.matchArgsToParams - the implementation, kept there to avoid a load-time import cycle.

    • toSpec: function
      • Binds a call's graph args against the formals, reading nothing from the graph, so it also serves a function whose parameters are not in the AST at all. Name '...' in a specification unless the function really has none, as that is what collects arguments finding no formal of their own.

        Type Parameters

        • Targets extends NodeId = string

        Parameters

        • this: void
        • args: readonly FunctionArgument[]

          The arguments as the graph holds them, see convertFnArguments.

        • params: Record<string, Targets> | readonly SigParameter[]

          Formal name to the target it stands for, or a signature whose names are the targets.

        Returns Map<Targets, NodeId[]>

        Per target the ids bound to it.

    MatchArgs.toNames(call.arguments, ['x', 'value']).get('value');
    MatchArgs.toSpec(args, { file: 'fileId', '...': '...' }).get('fileId');