-
Notifications
You must be signed in to change notification settings - Fork 14
[Query] Happens Before
This document was generated from 'src/documentation/wiki-query.ts' on 2026-07-20, 13:05:03 UTC presenting an overview of flowR's query API (v2.12.3). Please do not edit this file/wiki page directly.
Happens-Before Query [overview]
Check whether one normalized AST node happens before another in the CFG.
This query is requested with the type happens-before.
With this query you can analyze the control flow graph:
Using the example code:
x <- 1
y <- 2the following query returns that the first assignment happens always before the other:
[
{
"type": "happens-before",
"a": "1@x",
"b": "2@y"
}
]Results (prettified and summarized):
Query: happens-before (1 ms)
╰ 1@x<2@y: always
All queries together required ≈1 ms (1ms accuracy, total 2 ms)
Show Detailed Results as Json
The analysis required 1.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.
{
"happens-before": {
".meta": {
"timing": 1
},
"results": {
"1@x<2@y": "always"
}
},
".meta": {
"timing": 1
}
}Original Code
x <- 1
y <- 2Dataflow Graph of the R Code
The analysis required 1.4 ms (including parse and normalize, using the r-shell engine) within the generation environment. No signature database is mounted for these generated graphs, so library() calls attach no package exports; base-R names are still qualified via the generated base-package store (e.g. acf as stats::acf).
We encountered no unknown side effects during the analysis.
flowchart LR
1{{"`*#91;RNumber#93;* **1**
*1.6* (**id: 1**)`"}}
%% No edges found for 1
0["`*#91;RSymbol#93;* **x**
*1.1* (**id: 0**, v: 1)`"]
2[["`*#91;RBinaryOp#93;* base#58;#58;**#60;#45;**
*1.1-6* (**id: 2**)
arg: (0, 1)`"]]
built-in:_-["`Built-In:
#60;#45;`"]
style built-in:_- stroke:gray,fill:gray,stroke-width:2px,opacity:.8;
4{{"`*#91;RNumber#93;* **2**
*2.6* (**id: 4**)`"}}
%% No edges found for 4
3["`*#91;RSymbol#93;* **y**
*2.1* (**id: 3**, v: 4)`"]
5[["`*#91;RBinaryOp#93;* base#58;#58;**#60;#45;**
*2.1-6* (**id: 5**)
arg: (3, 4)`"]]
0 -->|"defined-by"| 1
0 -->|"defined-by"| 2
2 -->|"reads, arg"| 1
2 -->|"returns, arg"| 0
2 -.->|"reads, calls"| built-in:_-
linkStyle 4 stroke:gray;
3 -->|"defined-by"| 4
3 -->|"defined-by"| 5
5 -->|"reads, arg"| 4
5 -->|"returns, arg"| 3
5 -.->|"reads, calls"| built-in:_-
linkStyle 9 stroke:gray;
Implementation Details
Responsible for the execution of the Happens-Before Query query is executeSearch in ./src/queries/catalog/happens-before-query/happens-before-query-executor.ts.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information