Skip to content

[Query] Input Sources

github-actions[bot] edited this page Jul 21, 2026 · 1 revision

This document was generated from 'src/documentation/wiki-query.ts' on 2026-07-20, 17:48:27 UTC presenting an overview of flowR's query API (v2.12.3). Please do not edit this file/wiki page directly.

Input Sources Query [overview]

Classify the input sources of function calls
This query is requested with the type input-sources.
Run in the REPL: :query @input-sources (<criterion>) <code | file://path>

Given a slicing criterion to something like a function call, flowR classifies the types of all input sources (e.g., arguments).

To exemplify the query, consider the following code:

f <- function(x) {
	x <- x * 2
	print(x)
}

If you are interested in the input-sources of the print call, you can use:

[
  {
    "type": "input-sources",
    "criterion": "3@print"
  }
]

(This can be shortened to @input-sources (3@print) "f <- function(x) {\n x <- x * 2\n print(x)\n}" when used with the REPL command :query).

Results (prettified and summarized):

Query: input-sources (12 ms)
   ╰ Input Sources for 3@print
           ╰ 3.15 (id: 11), type: ["param","const","dconst"], trace: alias
All queries together required ≈13 ms (1ms accuracy, total 13 ms)

Show Detailed Results as Json

The analysis required 12.9 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "input-sources": {
    ".meta": {
      "timing": 12
    },
    "results": {
      "3@print": [
        {
          "id": 11,
          "types": [
            "param",
            "const",
            "dconst"
          ],
          "trace": "alias"
        }
      ]
    }
  },
  ".meta": {
    "timing": 13
  }
}
Implementation Details

Responsible for the execution of the Input Sources Query query is executeInputSourcesQuery in ./src/queries/catalog/input-sources-query/input-sources-query-executor.ts.

Clone this wiki locally