@eagleoutice/flowr 2.0.15 → 2.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,20 +1,30 @@
1
1
  [![flowR logo](https://raw.githubusercontent.com/wiki/flowr-analysis/flowr/img/flowR.png)](https://github.com/flowr-analysis/flowr/wiki)\
2
- [![QA (and potentially deploy)](https://github.com/flowr-analysis/flowr/actions/workflows/qa.yaml/badge.svg)](https://github.com/flowr-analysis/flowr/actions/workflows/qa.yaml) [![codecov](https://codecov.io/gh/flowr-analysis/flowr/graph/badge.svg)](https://codecov.io/gh/flowr-analysis/flowr) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/eagleoutice/flowr?logo=docker&logoColor=white&label=dockerhub)](https://hub.docker.com/r/eagleoutice/flowr) [![latest tag](https://badgen.net/github/tag/flowr-analysis/flowr?label=latest&color=purple)](https://github.com/flowr-analysis/flowr/releases/latest) [![Marketplace](https://badgen.net/vs-marketplace/v/code-inspect.vscode-flowr)](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr) [![All Contributors](https://img.shields.io/github/all-contributors/flowr-analysis/flowr)](#contributors)
2
+ [![QA (and potentially deploy)](https://github.com/flowr-analysis/flowr/actions/workflows/qa.yaml/badge.svg)](https://github.com/flowr-analysis/flowr/actions/workflows/qa.yaml) [![codecov](https://codecov.io/gh/flowr-analysis/flowr/graph/badge.svg)](https://codecov.io/gh/flowr-analysis/flowr) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/eagleoutice/flowr?logo=docker&logoColor=white&label=dockerhub)](https://hub.docker.com/r/eagleoutice/flowr) [![latest tag](https://badgen.net/github/tag/flowr-analysis/flowr?label=latest&color=purple)](https://github.com/flowr-analysis/flowr/releases/latest) [![Marketplace](https://badgen.net/vs-marketplace/v/code-inspect.vscode-flowr)](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr) [![All Contributors](https://img.shields.io/github/all-contributors/flowr-analysis/flowr)](#contributors)
3
3
  [![DOI](https://zenodo.org/badge/624819038.svg)](https://zenodo.org/doi/10.5281/zenodo.13319290)
4
4
 
5
- _flowR_ is a static [dataflow analyzer](https://en.wikipedia.org/wiki/Data-flow_analysis) and [program slicer](https://github.com/flowr-analysis/flowr/wiki/Terminology#program-slice) for the [_R_](https://www.r-project.org/) programming language (currently tested for versions `4.x` and `3.6.x`). It is available as a [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr) and as a [docker image](https://hub.docker.com/r/eagleoutice/flowr).
5
+ _flowR_ is a static [dataflow analyzer](https://en.wikipedia.org/wiki/Data-flow_analysis) and [program slicer](https://github.com/flowr-analysis/flowr/wiki/Terminology#program-slice) for the [_R_](https://www.r-project.org/) programming language (currently tested for versions `4.x` and `3.6.x`). You can get and use _flowR_ as a [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr), [RStudio Addin](https://github.com/flowr-analysis/rstudio-addin-flowr), [R package](https://github.com/flowr-analysis/flowr-r-adapter), and as a [Docker image](https://hub.docker.com/r/eagleoutice/flowr).
6
6
 
7
7
  ## ⭐ Getting Started
8
8
 
9
- To get started with _flowR_, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/Overview). The [Setup](https://github.com/flowr-analysis/flowr/wiki/Setup) wiki page explains how you can download and setup _flowR_ on your system. For Visual Studio Code, please see the [marketplace entry](https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr). With docker 🐳️, the following line should be enough (and drop you directly into the REPL):
9
+ To get started with _flowR_ and its features, please check out the [Overview](https://github.com/flowr-analysis/flowr/wiki/Overview) page. The [Setup](https://github.com/flowr-analysis/flowr/wiki/Setup) wiki page explains how you can download and setup _flowR_ on your system. With docker 🐳️, the following line should be enough (and drop you directly into the read-eval-print loop):
10
10
 
11
11
  ```shell
12
12
  docker run -it --rm eagleoutice/flowr
13
- ```
13
+ ```
14
+
15
+ You can enter `:help` to gain more information on its capabilities.
16
+
17
+ <details>
18
+
19
+ <summary>Example REPL session.</summary>
20
+
21
+ ![Example of a simple REPL session](wiki/gif/repl-demo.gif)
22
+
23
+ </details>
14
24
 
15
25
  ## 📜 More Information
16
26
 
17
- For more details, see the [wiki pages](https://github.com/flowr-analysis/flowr/wiki) and the deployed [code documentation](https://flowr-analysis.github.io/flowr/doc/).
27
+ For more details on how to use _flowR_ please refer to the the [wiki pages](https://github.com/flowr-analysis/flowr/wiki), as well as the deployed [code documentation](https://flowr-analysis.github.io/flowr/doc/).
18
28
 
19
29
  ## 🚀 Contributing
20
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eagleoutice/flowr",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "description": "Static Dataflow Analyzer and Program Slicer for the R Programming Language",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "repository": {
@@ -268,8 +268,8 @@ function reconstructArgument(argument, name, value) {
268
268
  }
269
269
  }
270
270
  function reconstructParameter(parameter, name, defaultValue, configuration) {
271
- if (!isSelected(configuration, parameter)) {
272
- return [];
271
+ if (isSelected(configuration, parameter)) {
272
+ return plain(getLexeme(parameter));
273
273
  }
274
274
  if (parameter.defaultValue !== undefined && name.length > 0) {
275
275
  return plain(`${getLexeme(parameter.name)}=${getLexeme(parameter.defaultValue)}`);
@@ -282,7 +282,7 @@ function reconstructParameter(parameter, name, defaultValue, configuration) {
282
282
  }
283
283
  }
284
284
  function reconstructFunctionDefinition(definition, functionParameters, body, config) {
285
- // if a definition is not selected, we only use the body - slicing will always select the definition
285
+ // if a definition is not selected, we only use the body - slicing will always select the definition if it is required
286
286
  if (functionParameters.every(p => p.length === 0)) {
287
287
  const empty = body === undefined || body.length === 0;
288
288
  const selected = isSelected(config, definition);
@@ -7,6 +7,7 @@ const linker_1 = require("../../dataflow/internal/linker");
7
7
  const environment_1 = require("../../dataflow/environments/environment");
8
8
  const scoping_1 = require("../../dataflow/environments/scoping");
9
9
  const overwrite_1 = require("../../dataflow/environments/overwrite");
10
+ const graph_1 = require("../../dataflow/graph/graph");
10
11
  const built_in_1 = require("../../dataflow/environments/built-in");
11
12
  const resolve_by_name_1 = require("../../dataflow/environments/resolve-by-name");
12
13
  const edge_1 = require("../../dataflow/graph/edge");
@@ -23,6 +24,31 @@ function retrieveActiveEnvironment(callerInfo, baseEnvironment) {
23
24
  }
24
25
  return (0, overwrite_1.overwriteEnvironment)(baseEnvironment, callerEnvironment);
25
26
  }
27
+ function includeArgumentFunctionCallClosure(arg, baseEnvironment, activeEnvironment, queue, dataflowGraph) {
28
+ const valueRoot = (0, graph_1.getReferenceOfArgument)(arg);
29
+ if (!valueRoot) {
30
+ return;
31
+ }
32
+ const callTargets = (0, linker_1.getAllLinkedFunctionDefinitions)(new Set([valueRoot]), dataflowGraph);
33
+ linkCallTargets(false, callTargets, baseEnvironment, (0, fingerprint_1.envFingerprint)(baseEnvironment), activeEnvironment, (0, fingerprint_1.envFingerprint)(activeEnvironment), queue);
34
+ }
35
+ function linkCallTargets(onlyForSideEffects, functionCallTargets, baseEnvironment, baseEnvPrint, activeEnvironment, activeEnvironmentFingerprint, queue) {
36
+ for (const functionCallTarget of functionCallTargets) {
37
+ // all those linked within the scopes of other functions are already linked when exiting a function definition
38
+ for (const openIn of functionCallTarget.subflow.in) {
39
+ const defs = openIn.name ? (0, resolve_by_name_1.resolveByName)(openIn.name, activeEnvironment) : undefined;
40
+ if (defs === undefined) {
41
+ continue;
42
+ }
43
+ for (const def of defs.filter(d => d.nodeId !== built_in_1.BuiltIn)) {
44
+ queue.add(def.nodeId, baseEnvironment, baseEnvPrint, onlyForSideEffects);
45
+ }
46
+ }
47
+ for (const exitPoint of functionCallTarget.exitPoints) {
48
+ queue.add(exitPoint, activeEnvironment, activeEnvironmentFingerprint, onlyForSideEffects);
49
+ }
50
+ }
51
+ }
26
52
  /** returns the new threshold hit count */
27
53
  function sliceForCall(current, callerInfo, dataflowGraph, queue) {
28
54
  // bind with call-local environments during slicing
@@ -42,21 +68,17 @@ function sliceForCall(current, callerInfo, dataflowGraph, queue) {
42
68
  }
43
69
  }
44
70
  const functionCallTargets = (0, linker_1.getAllLinkedFunctionDefinitions)(new Set(functionCallDefs), dataflowGraph);
45
- for (const functionCallTarget of functionCallTargets) {
46
- // all those linked within the scopes of other functions are already linked when exiting a function definition
47
- for (const openIn of functionCallTarget.subflow.in) {
48
- const defs = openIn.name ? (0, resolve_by_name_1.resolveByName)(openIn.name, activeEnvironment) : undefined;
49
- if (defs === undefined) {
50
- continue;
51
- }
52
- for (const def of defs.filter(d => d.nodeId !== built_in_1.BuiltIn)) {
53
- queue.add(def.nodeId, baseEnvironment, baseEnvPrint, current.onlyForSideEffects);
54
- }
55
- }
56
- for (const exitPoint of functionCallTarget.exitPoints) {
57
- queue.add(exitPoint, activeEnvironment, activeEnvironmentFingerprint, current.onlyForSideEffects);
71
+ if (functionCallTargets.size === 0) {
72
+ /*
73
+ * if we do not have any call to resolve this function, we have to assume that every function passed is actually called!
74
+ * hence, we add a new flag and add all argument values to the queue causing directly
75
+ */
76
+ for (const arg of callerInfo.args) {
77
+ includeArgumentFunctionCallClosure(arg, baseEnvironment, activeEnvironment, queue, dataflowGraph);
58
78
  }
79
+ return;
59
80
  }
81
+ linkCallTargets(current.onlyForSideEffects, functionCallTargets, baseEnvironment, baseEnvPrint, activeEnvironment, activeEnvironmentFingerprint, queue);
60
82
  }
61
83
  exports.sliceForCall = sliceForCall;
62
84
  /** Returns true if we found at least one return edge */
package/util/version.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.flowrVersion = void 0;
4
4
  const semver_1 = require("semver");
5
5
  // this is automatically replaced with the current version by release-it
6
- const version = '2.0.15';
6
+ const version = '2.0.16';
7
7
  function flowrVersion() {
8
8
  return new semver_1.SemVer(version);
9
9
  }