@eagleoutice/flowr 2.4.7 → 2.4.8
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 +43 -39
- package/abstract-interpretation/data-frame/absint-visitor.js +3 -2
- package/benchmark/slicer.js +1 -1
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/cli/repl/commands/repl-query.js +11 -2
- package/cli/repl/core.d.ts +2 -2
- package/cli/repl/core.js +26 -7
- package/cli/repl/server/connection.js +3 -1
- package/cli/repl/server/messages/message-slice.d.ts +3 -0
- package/cli/repl/server/messages/message-slice.js +2 -0
- package/control-flow/extract-cfg.d.ts +3 -3
- package/control-flow/extract-cfg.js +4 -4
- package/control-flow/useless-loop.js +30 -21
- package/dataflow/environments/built-in.d.ts +1 -1
- package/dataflow/environments/default-builtin-config.d.ts +9 -0
- package/dataflow/environments/default-builtin-config.js +21 -21
- package/dataflow/environments/environment.js +18 -9
- package/dataflow/environments/overwrite.js +2 -2
- package/dataflow/extractor.js +1 -1
- package/dataflow/graph/diff-dataflow-graph.js +4 -4
- package/dataflow/graph/graph.d.ts +3 -3
- package/dataflow/graph/graph.js +4 -1
- package/dataflow/graph/quads.js +4 -4
- package/dataflow/info.js +1 -1
- package/dataflow/internal/linker.d.ts +2 -0
- package/dataflow/internal/linker.js +18 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +3 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +68 -21
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +5 -18
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +4 -5
- package/dataflow/internal/process/functions/call/common.js +4 -3
- package/documentation/doc-util/doc-query.js +6 -2
- package/documentation/doc-util/doc-types.d.ts +7 -2
- package/documentation/doc-util/doc-types.js +20 -4
- package/documentation/print-core-wiki.js +5 -1
- package/documentation/print-dataflow-graph-wiki.js +21 -12
- package/documentation/print-faq-wiki.js +5 -0
- package/documentation/print-interface-wiki.js +2 -0
- package/documentation/print-linter-wiki.js +2 -3
- package/documentation/print-query-wiki.js +22 -7
- package/linter/linter-executor.js +25 -17
- package/linter/linter-format.d.ts +10 -1
- package/linter/linter-format.js +8 -0
- package/linter/linter-rules.d.ts +1 -0
- package/linter/rules/absolute-path.js +8 -8
- package/linter/rules/dataframe-access-validation.js +1 -1
- package/linter/rules/file-path-validity.js +8 -11
- package/linter/rules/naming-convention.d.ts +5 -1
- package/linter/rules/naming-convention.js +24 -8
- package/linter/rules/seeded-randomness.js +2 -2
- package/linter/rules/unused-definition.js +1 -1
- package/package.json +17 -15
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +5 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +14 -12
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +6 -5
- package/queries/catalog/call-context-query/call-context-query-format.js +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +2 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +1 -1
- package/queries/catalog/config-query/config-query-executor.js +7 -1
- package/queries/catalog/config-query/config-query-format.d.ts +7 -0
- package/queries/catalog/config-query/config-query-format.js +72 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +50 -75
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +50 -26
- package/queries/catalog/dependencies-query/dependencies-query-format.js +75 -20
- package/queries/catalog/dependencies-query/function-info/function-info.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/visualize-functions.d.ts +2 -0
- package/queries/catalog/dependencies-query/function-info/visualize-functions.js +13 -0
- package/queries/catalog/happens-before-query/happens-before-query-executor.js +1 -1
- package/queries/catalog/linter-query/linter-query-format.js +4 -0
- package/queries/query-print.d.ts +2 -2
- package/queries/query-print.js +3 -2
- package/queries/query.d.ts +28 -21
- package/search/flowr-search-builder.d.ts +1 -1
- package/search/flowr-search-builder.js +1 -1
- package/search/flowr-search-filters.d.ts +20 -10
- package/search/flowr-search-filters.js +19 -3
- package/search/search-executor/search-enrichers.d.ts +1 -1
- package/search/search-executor/search-enrichers.js +3 -2
- package/search/search-executor/search-generators.js +1 -1
- package/search/search-executor/search-transformer.js +1 -1
- package/util/objects.d.ts +11 -0
- package/util/objects.js +26 -0
- package/util/version.js +1 -1
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { BuiltInDefinitions } from './built-in-config';
|
|
2
2
|
import type { BuiltInMappingName } from './built-in';
|
|
3
|
+
export declare const GgPlotCreate: readonly ["ggplot", "ggplotly", "ggMarginal", "ggcorrplot", "ggseasonplot", "ggdendrogram", "qmap", "qplot", "quickplot", "autoplot", "grid.arrange", "fviz_pca_biplot", "fviz_pca", "fviz_pca_ind", "fviz_pca_var", "fviz_screeplot", "fviz_mca_biplot", "fviz_mca", "fviz_mca_ind", "fviz_mca_var", "fviz_cluster", "fviz_dend", "ggsurvplot"];
|
|
4
|
+
export declare const TinyPlotCrate: readonly ["tinyplot", "plt"];
|
|
5
|
+
export declare const GraphicsPlotCreate: string[];
|
|
6
|
+
export declare const PlotCreate: string[];
|
|
7
|
+
export declare const TinyPlotAddons: string[];
|
|
8
|
+
export declare const GgPlotImplicitAddons: readonly ["geom_count", "geom_bin_2d", "geom_spoke", "geom_tile", "geom_rect", "geom_function", "geom_crossbar", "geom_density2d", "geom_abline", "geom_errorbar", "geom_errorbarh", "geom_jitter", "geom_line", "geom_density", "geom_quantile", "geom_qq", "geom_qq_line", "geom_segment", "geom_label", "geom_density_2d", "geom_violin", "geom_contour", "geom_boxplot", "geom_col", "geom_blank", "geom_histogram", "geom_hline", "geom_area", "geom_sf_text", "geom_smooth", "geom_text", "geom_density2d_filled", "geom_ribbon", "geom_sf", "geom_dotplot", "geom_freqpoly", "geom_step", "geom_map", "geom_bin2d", "geom_rug", "geom_raster", "geom_pointrange", "geom_point", "geom_hex", "geom_contour_filled", "geom_bar", "geom_vline", "geom_linerange", "geom_curve", "geom_path", "geom_polygon", "geom_sf_label", "geom_density_2d_filled", "geom_dumbbell", "geom_encircle", "stat_count", "stat_density", "stat_bin_hex", "stat_bin_2d", "stat_summary_bin", "stat_identity", "stat_qq", "stat_binhex", "stat_boxplot", "stat_function", "stat_align", "stat_contour_filled", "stat_summary_2d", "stat_qq_line", "stat_contour", "stat_ydensity", "stat_summary_hex", "stat_summary2d", "stat_sf_coordinates", "stat_density_2d_filled", "stat_smooth", "stat_density2d", "stat_ecdf", "stat_sf", "stat_quantile", "stat_unique", "stat_density_2d", "stat_ellipse", "stat_summary", "stat_density2d_filled", "stat_bin", "stat_sum", "stat_spoke", "stat_bin2d", "labs", "theme_void", "theme_test", "theme_minimal", "theme_light", "theme", "theme_get", "theme_gray", "theme_dark", "theme_classic", "theme_linedraw", "theme_update", "theme_replace", "theme_grey", "theme_bw", "theme_tufte", "theme_survminer", "facet_null", "facet_grid", "facet_wrap", "xlab", "xlim", "ylab", "ylim", "scale_linewidth_ordinal", "scale_fill_steps", "scale_color_gradient2", "scale_size_manual", "scale_colour_discrete", "scale_color_identity", "scale_fill_fermenter", "scale_alpha_manual", "scale_fill_gradient", "scale_size_date", "scale_fill_viridis_b", "scale_x_time", "scale_linetype_manual", "scale_alpha_binned", "scale_color_grey", "scale_colour_gradient", "scale_linewidth_date", "scale_color_steps2", "scale_color_viridis_b", "scale_size_binned", "scale_colour_gradientn", "scale_linewidth_manual", "scale_fill_viridis_c", "scale_fill_manual", "scale_color_viridis_c", "scale_fill_discrete", "scale_size_discrete", "scale_fill_binned", "scale_fill_viridis_d", "scale_colour_fermenter", "scale_color_viridis_d", "scale_x_datetime", "scale_size_identity", "scale_linewidth_identity", "scale_shape_ordinal", "scale_linewidth_discrete", "scale_fill_ordinal", "scale_y_time", "scale_color_ordinal", "scale_size_ordinal", "scale_colour_distiller", "scale_linewidth_datetime", "scale_alpha_identity", "scale_color_steps", "scale_alpha_discrete", "scale_fill_date", "scale_x_reverse", "scale_fill_gradientn", "scale_size_datetime", "scale_y_continuous", "scale_colour_steps", "scale_color_distiller", "scale_colour_ordinal", "scale_y_datetime", "scale_linetype_discrete", "scale_colour_viridis_b", "scale_alpha_datetime", "scale_continuous_identity", "scale_fill_brewer", "scale_shape_identity", "scale_color_discrete", "scale_colour_viridis_c", "scale_linetype_identity", "scale_colour_hue", "scale_linewidth_binned", "scale_color_hue", "scale_shape_continuous", "scale_colour_viridis_d", "scale_size_continuous", "scale_color_manual", "scale_alpha_date", "scale_y_sqrt", "scale_shape_binned", "scale_size", "scale_color_fermenter", "scale_color_stepsn", "scale_size_area", "scale_y_binned", "scale_y_discrete", "scale_alpha_continuous", "scale_fill_continuous", "scale_linetype_continuous", "scale_colour_steps2", "scale_colour_datetime", "scale_colour_grey", "scale_x_log10", "scale_x_discrete", "scale_color_continuous", "scale_type", "scale_y_reverse", "scale_colour_gradient2", "scale_color_datetime", "scale_color_date", "scale_x_continuous", "scale_colour_manual", "scale_fill_gradient2", "scale_fill_grey", "scale_colour_stepsn", "scale_colour_binned", "scale_color_binned", "scale_color_gradientn", "scale_colour_date", "scale_fill_distiller", "scale_color_gradient", "scale_linewidth_continuous", "scale_shape", "scale_fill_hue", "scale_linetype", "scale_colour_identity", "scale_discrete_manual", "scale_fill_identity", "scale_y_log10", "scale_linetype_binned", "scale_size_binned_area", "scale_y_date", "scale_x_binned", "scale_shape_discrete", "scale_colour_brewer", "scale_x_date", "scale_discrete_identity", "scale_alpha", "scale_fill_steps2", "scale_color_brewer", "scale_fill_datetime", "scale_shape_manual", "scale_colour_continuous", "scale_alpha_ordinal", "scale_linewidth", "scale_x_sqrt", "scale_fill_stepsn", "scale_radius", "rotateTextX", "removeGridX", "removeGridY", "removeGrid", "coord_trans", "coord_sf", "coord_cartesian", "coord_fixed", "coord_flip", "coord_quickmap", "coord_equal", "coord_map", "coord_polar", "coord_munch", "coord_radial", "annotate", "annotation_custom", "annotation_raster", "annotation_map", "annotation_logticks", "borders", "ggtitle", "expansion", "expand_limits", "expand_scale", "guides", "wrap_by", "theme_solid", "theme_hc", "theme_excel_new", "theme_few", "theme_clean", "theme_wsj", "theme_calc", "theme_par", "theme_tufte", "theme_igray", "theme_solarized_2", "theme_excel", "theme_economist", "theme_stata", "theme_map", "theme_fivethirtyeight", "theme_economist_white", "theme_base", "theme_foundation", "theme_gdocs", "theme_pander", "theme_solarized", "scale_shape_tableau", "scale_fill_pander", "scale_shape_few", "scale_colour_excel_new", "scale_colour_hc", "scale_fill_ptol", "scale_fill_gradient2_tableau", "scale_shape_calc", "scale_fill_stata", "scale_colour_tableau", "scale_colour_colorblind", "scale_color_stata", "scale_colour_economist", "scale_fill_calc", "scale_fill_gradient_tableau", "scale_shape_cleveland", "scale_color_pander", "scale_colour_pander", "scale_color_fivethirtyeight", "scale_color_wsj", "scale_shape_stata", "scale_colour_gdocs", "scale_color_continuous_tableau", "scale_fill_excel", "scale_color_few", "scale_linetype_stata", "scale_shape_tremmel", "scale_color_tableau", "scale_color_colorblind", "scale_fill_colorblind", "scale_colour_stata", "scale_fill_wsj", "scale_colour_calc", "scale_colour_fivethirtyeight", "scale_fill_hc", "scale_shape_circlefill", "scale_fill_excel_new", "scale_color_solarized", "scale_color_excel", "scale_colour_excel", "scale_fill_tableau", "scale_colour_ptol", "scale_colour_canva", "scale_color_gradient2_tableau", "scale_colour_solarized", "scale_colour_gradient2_tableau", "scale_fill_canva", "scale_color_ptol", "scale_color_excel_new", "scale_color_economist", "scale_fill_economist", "scale_fill_fivethirtyeight", "scale_colour_gradient_tableau", "scale_colour_few", "scale_color_calc", "scale_fill_few", "scale_fill_gdocs", "scale_color_hc", "scale_color_gdocs", "scale_color_canva", "scale_color_gradient_tableau", "scale_fill_solarized", "scale_fill_continuous_tableau", "scale_colour_wsj", "gradient_color", "ggsurvplot_add_all"];
|
|
9
|
+
export declare const PlotFunctionsWithAddParam: Set<string>;
|
|
10
|
+
export declare const GraphicsPlotAddons: string[];
|
|
11
|
+
export declare const GgPlotAddons: string[];
|
|
3
12
|
/**
|
|
4
13
|
* Contains the built-in definitions recognized by flowR
|
|
5
14
|
*/
|
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultBuiltinConfig = void 0;
|
|
3
|
+
exports.DefaultBuiltinConfig = exports.GgPlotAddons = exports.GraphicsPlotAddons = exports.PlotFunctionsWithAddParam = exports.GgPlotImplicitAddons = exports.TinyPlotAddons = exports.PlotCreate = exports.GraphicsPlotCreate = exports.TinyPlotCrate = exports.GgPlotCreate = void 0;
|
|
4
4
|
exports.getDefaultProcessor = getDefaultProcessor;
|
|
5
5
|
const identify_link_to_last_call_relation_1 = require("../../queries/catalog/call-context-query/identify-link-to-last-call-relation");
|
|
6
6
|
const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
|
|
7
7
|
const cascade_action_1 = require("../../queries/catalog/call-context-query/cascade-action");
|
|
8
8
|
const unnamed_call_handling_1 = require("../internal/process/functions/call/unnamed-call-handling");
|
|
9
|
-
|
|
9
|
+
exports.GgPlotCreate = [
|
|
10
10
|
'ggplot', 'ggplotly', 'ggMarginal', 'ggcorrplot', 'ggseasonplot', 'ggdendrogram', 'qmap', 'qplot', 'quickplot', 'autoplot', 'grid.arrange',
|
|
11
11
|
'fviz_pca_biplot', 'fviz_pca', 'fviz_pca_ind', 'fviz_pca_var', 'fviz_screeplot', 'fviz_mca_biplot', 'fviz_mca', 'fviz_mca_ind', 'fviz_mca_var', 'fviz_cluster', 'fviz_dend',
|
|
12
12
|
'ggsurvplot',
|
|
13
13
|
];
|
|
14
|
-
|
|
14
|
+
exports.TinyPlotCrate = [
|
|
15
15
|
'tinyplot', 'plt'
|
|
16
16
|
];
|
|
17
|
-
|
|
17
|
+
exports.GraphicsPlotCreate = [
|
|
18
18
|
'plot', 'plot.new', 'xspline', 'map', 'curve', 'image', 'boxplot', 'dotchart', 'sunflowerplot', 'barplot', 'matplot', 'hist', 'stem',
|
|
19
19
|
'density', 'smoothScatter', 'contour', 'persp', 'XYPlot', 'xyplot', 'stripplot', 'bwplot', 'dotPlot', 'dotplot', 'histPlot', 'densityPlot', 'qPlot', 'qqplot', 'qqPlot', 'boxPlot',
|
|
20
20
|
'bxp', 'assocplot', 'mosaicplot', 'stripchart', 'fourfoldplot', 'plot.xy', 'plot.formula', 'plot.default', 'plot.design', 'stars', 'cotabplot', 'pheatmap',
|
|
21
21
|
'spineplot', 'Plotranges', 'regressogram', 'bootcurve', 'meanplot', 'vioplot', 'pairs', 'copolot', 'histogram', 'splom', 'leaflet', 'tm_shape', 'plot_ly', 'plotProfLik', 'plotSimulatedResiduals', 'plotmeans',
|
|
22
22
|
'overplot', 'residplot', 'heatmap.2', 'lmplot2', 'sinkplot', 'textplot', 'boxplot2', 'profLikCI',
|
|
23
|
-
...TinyPlotCrate,
|
|
24
|
-
...GgPlotCreate
|
|
25
23
|
];
|
|
24
|
+
exports.PlotCreate = exports.GraphicsPlotCreate.concat(exports.TinyPlotCrate, exports.GgPlotCreate);
|
|
26
25
|
const GraphicDeviceOpen = [
|
|
27
26
|
'pdf', 'jpeg', 'png', 'windows', 'postscript', 'xfig', 'bitmap', 'pictex', 'cairo_pdf', 'svg', 'bmp', 'tiff', 'X11', 'quartz', 'image_graph',
|
|
28
27
|
'image_draw', 'dev.new', 'trellis.device', 'raster_pdf', 'agg_pdf'
|
|
29
28
|
];
|
|
30
|
-
|
|
29
|
+
exports.TinyPlotAddons = [
|
|
31
30
|
'tinyplot_add', 'plt_add'
|
|
32
31
|
];
|
|
33
|
-
|
|
32
|
+
exports.GgPlotImplicitAddons = [
|
|
34
33
|
'geom_count', 'geom_bin_2d', 'geom_spoke', 'geom_tile', 'geom_rect',
|
|
35
34
|
'geom_function', 'geom_crossbar', 'geom_density2d', 'geom_abline', 'geom_errorbar', 'geom_errorbarh',
|
|
36
35
|
'geom_jitter', 'geom_line', 'geom_density', 'geom_quantile', 'geom_qq', 'geom_qq_line', 'geom_segment', 'geom_label', 'geom_density_2d',
|
|
@@ -75,17 +74,18 @@ const GgPlotImplicitAddons = [
|
|
|
75
74
|
'scale_colour_gradient_tableau', 'scale_colour_few', 'scale_color_calc', 'scale_fill_few', 'scale_fill_gdocs', 'scale_color_hc', 'scale_color_gdocs', 'scale_color_canva', 'scale_color_gradient_tableau',
|
|
76
75
|
'scale_fill_solarized', 'scale_fill_continuous_tableau', 'scale_colour_wsj', 'gradient_color', 'ggsurvplot_add_all'
|
|
77
76
|
];
|
|
78
|
-
|
|
77
|
+
exports.PlotFunctionsWithAddParam = new Set([
|
|
79
78
|
'map', 'matplot', 'barplot', 'boxplot', 'curve', 'image', 'plotCI', 'bandplot', 'barplot2', 'bubbleplot'
|
|
80
79
|
]);
|
|
81
|
-
|
|
80
|
+
exports.GraphicsPlotAddons = [
|
|
82
81
|
'points', 'abline', 'mtext', 'lines', 'text', 'legend', 'title', 'axis', 'polygon', 'polypath', 'pie', 'rect', 'segments', 'arrows', 'symbols',
|
|
83
82
|
'qqline', 'qqnorm', 'rasterImage',
|
|
84
|
-
'tiplabels', 'rug', 'grid', 'box', 'clip', 'matpoints', 'matlines',
|
|
83
|
+
'tiplabels', 'rug', 'grid', 'box', 'clip', 'matpoints', 'matlines',
|
|
85
84
|
];
|
|
86
|
-
|
|
85
|
+
exports.GgPlotAddons = [
|
|
87
86
|
'ggdraw', 'last_plot'
|
|
88
87
|
];
|
|
88
|
+
const PlotAddons = exports.GraphicsPlotAddons.concat(exports.GgPlotImplicitAddons, ...exports.PlotFunctionsWithAddParam);
|
|
89
89
|
function toRegex(n) {
|
|
90
90
|
return new RegExp(`^(${[...new Set(n)].map(s => s.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')).filter(s => s.length > 0).join('|')})$`);
|
|
91
91
|
}
|
|
@@ -129,7 +129,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
129
129
|
{ type: 'function', names: ['apply', 'tapply', 'Tapply'], processor: 'builtin:apply', config: { indexOfFunction: 2, nameOfFunctionArgument: 'FUN' }, assumePrimitive: false },
|
|
130
130
|
{ type: 'function', names: ['print', 'message', 'warning'], processor: 'builtin:default', config: { returnsNthArgument: 0, forceArgs: 'all', hasUnknownSideEffects: { type: 'link-to-last-call', callName: /^sink$/ } }, assumePrimitive: false },
|
|
131
131
|
// graphics base
|
|
132
|
-
{ type: 'function', names: PlotCreate,
|
|
132
|
+
{ type: 'function', names: exports.PlotCreate,
|
|
133
133
|
processor: 'builtin:default',
|
|
134
134
|
config: {
|
|
135
135
|
forceArgs: 'all',
|
|
@@ -137,7 +137,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
137
137
|
type: 'link-to-last-call',
|
|
138
138
|
ignoreIf: (source, graph) => {
|
|
139
139
|
/* map with add = true appends to an existing plot */
|
|
140
|
-
return (PlotFunctionsWithAddParam.has(source.name) && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
|
|
140
|
+
return (exports.PlotFunctionsWithAddParam.has(source.name) && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, source, {
|
|
141
141
|
index: -1,
|
|
142
142
|
name: 'add'
|
|
143
143
|
}, [type_1.RType.Logical])?.content === true);
|
|
@@ -154,11 +154,11 @@ exports.DefaultBuiltinConfig = [
|
|
|
154
154
|
},
|
|
155
155
|
hasUnknownSideEffects: {
|
|
156
156
|
type: 'link-to-last-call',
|
|
157
|
-
callName: toRegex([...PlotCreate, ...PlotAddons]),
|
|
157
|
+
callName: toRegex([...exports.PlotCreate, ...PlotAddons]),
|
|
158
158
|
ignoreIf: (source, graph) => {
|
|
159
159
|
const sourceVertex = graph.getVertex(source);
|
|
160
160
|
/* map with add = true appends to an existing plot */
|
|
161
|
-
return (PlotFunctionsWithAddParam.has(sourceVertex.name ?? '') && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
|
|
161
|
+
return (exports.PlotFunctionsWithAddParam.has(sourceVertex.name ?? '') && (0, identify_link_to_last_call_relation_1.getValueOfArgument)(graph, sourceVertex, {
|
|
162
162
|
index: -1,
|
|
163
163
|
name: 'add'
|
|
164
164
|
}, [type_1.RType.Logical])?.content !== true);
|
|
@@ -175,25 +175,25 @@ exports.DefaultBuiltinConfig = [
|
|
|
175
175
|
// plot tags
|
|
176
176
|
{
|
|
177
177
|
type: 'function',
|
|
178
|
-
names: GgPlotAddons,
|
|
178
|
+
names: exports.GgPlotAddons,
|
|
179
179
|
processor: 'builtin:default',
|
|
180
180
|
config: {
|
|
181
181
|
forceArgs: 'all',
|
|
182
182
|
hasUnknownSideEffects: {
|
|
183
183
|
type: 'link-to-last-call',
|
|
184
|
-
callName: toRegex([...GgPlotCreate, ...GgPlotAddons])
|
|
184
|
+
callName: toRegex([...exports.GgPlotCreate, ...exports.GgPlotAddons])
|
|
185
185
|
}
|
|
186
186
|
}, assumePrimitive: true
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
189
|
type: 'function',
|
|
190
|
-
names: TinyPlotAddons,
|
|
190
|
+
names: exports.TinyPlotAddons,
|
|
191
191
|
processor: 'builtin:default',
|
|
192
192
|
config: {
|
|
193
193
|
forceArgs: 'all',
|
|
194
194
|
hasUnknownSideEffects: {
|
|
195
195
|
type: 'link-to-last-call',
|
|
196
|
-
callName: toRegex([...TinyPlotCrate, ...TinyPlotAddons])
|
|
196
|
+
callName: toRegex([...exports.TinyPlotCrate, ...exports.TinyPlotAddons])
|
|
197
197
|
}
|
|
198
198
|
}, assumePrimitive: true
|
|
199
199
|
},
|
|
@@ -205,7 +205,7 @@ exports.DefaultBuiltinConfig = [
|
|
|
205
205
|
forceArgs: 'all',
|
|
206
206
|
hasUnknownSideEffects: {
|
|
207
207
|
type: 'link-to-last-call',
|
|
208
|
-
callName: toRegex([...GraphicDeviceOpen, ...PlotCreate, ...PlotAddons, ...GgPlotAddons, ...TinyPlotAddons])
|
|
208
|
+
callName: toRegex([...GraphicDeviceOpen, ...exports.PlotCreate, ...PlotAddons, ...exports.GgPlotAddons, ...exports.TinyPlotAddons])
|
|
209
209
|
}
|
|
210
210
|
}, assumePrimitive: true
|
|
211
211
|
},
|
|
@@ -18,8 +18,10 @@ function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = u
|
|
|
18
18
|
const definitions = ref.name ? (0, resolve_by_name_1.resolveByName)(ref.name, environments, ref.type) : undefined;
|
|
19
19
|
for (const definition of definitions ?? []) {
|
|
20
20
|
if (definition.type !== identifier_1.ReferenceType.BuiltInFunction && definition.type !== identifier_1.ReferenceType.BuiltInConstant) {
|
|
21
|
-
if (definition.controlDependencies
|
|
22
|
-
definition.controlDependencies.
|
|
21
|
+
if (definition.controlDependencies) {
|
|
22
|
+
if (defaultCd && !definition.controlDependencies.find(c => c.id === defaultCd.id && c.when === defaultCd.when)) {
|
|
23
|
+
definition.controlDependencies.push(defaultCd);
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
26
|
else {
|
|
25
27
|
definition.controlDependencies = defaultCd ? [defaultCd] : [];
|
|
@@ -30,20 +32,27 @@ function makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd = u
|
|
|
30
32
|
const node = graph.get(ref.nodeId, true);
|
|
31
33
|
if (node) {
|
|
32
34
|
const [fst] = node;
|
|
33
|
-
if (fst.cds
|
|
34
|
-
fst.cds.
|
|
35
|
+
if (fst.cds) {
|
|
36
|
+
if (defaultCd && !fst.cds.find(c => c.id === defaultCd.id && c.when === defaultCd.when)) {
|
|
37
|
+
fst.cds.push(defaultCd);
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
else {
|
|
37
41
|
fst.cds = defaultCd ? [defaultCd] : [];
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
|
-
|
|
44
|
+
if (ref.controlDependencies) {
|
|
45
|
+
if (defaultCd && !ref.controlDependencies.find(c => c.id === defaultCd.id && c.when === defaultCd.when)) {
|
|
46
|
+
return { ...ref, controlDependencies: (ref.controlDependencies ?? []).concat(defaultCd ? [defaultCd] : []) };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return { ...ref, controlDependencies: ref.controlDependencies ?? (defaultCd ? [defaultCd] : []) };
|
|
51
|
+
}
|
|
52
|
+
return ref;
|
|
41
53
|
}
|
|
42
54
|
function makeAllMaybe(references, graph, environments, includeDefs, defaultCd = undefined) {
|
|
43
|
-
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
return references.map(ref => makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd));
|
|
55
|
+
return references?.map(ref => makeReferenceMaybe(ref, graph, environments, includeDefs, defaultCd)) ?? [];
|
|
47
56
|
}
|
|
48
57
|
/**
|
|
49
58
|
* Please use this function only if you do not know the object type.
|
|
@@ -27,7 +27,7 @@ function overwriteIEnvironmentWith(base, next, includeParent = true, applyCds) {
|
|
|
27
27
|
if (hasMaybe) {
|
|
28
28
|
const old = map.get(key);
|
|
29
29
|
// we need to make a copy to avoid side effects for old reference in other environments
|
|
30
|
-
const updatedOld = old ?? [];
|
|
30
|
+
const updatedOld = [...old ?? []];
|
|
31
31
|
for (const v of values) {
|
|
32
32
|
const index = updatedOld.findIndex(o => o.nodeId === v.nodeId && o.definedAt === v.definedAt);
|
|
33
33
|
if (index < 0) {
|
|
@@ -42,7 +42,7 @@ function overwriteIEnvironmentWith(base, next, includeParent = true, applyCds) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
map.set(key,
|
|
45
|
+
map.set(key, updatedOld);
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
map.set(key, values);
|
package/dataflow/extractor.js
CHANGED
|
@@ -64,7 +64,7 @@ function resolveLinkToSideEffects(ast, graph) {
|
|
|
64
64
|
if (typeof s !== 'object') {
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
|
-
cfg ??= (0, extract_cfg_1.
|
|
67
|
+
cfg ??= (0, extract_cfg_1.extractCfgQuick)(ast).graph;
|
|
68
68
|
/* this has to change whenever we add a new link to relations because we currently offer no abstraction for the type */
|
|
69
69
|
const potentials = (0, identify_link_to_last_call_relation_1.identifyLinkToLastCallRelation)(s.id, cfg, graph, s.linkTo);
|
|
70
70
|
for (const pot of potentials) {
|
|
@@ -36,8 +36,8 @@ function diffDataflowGraph(ctx) {
|
|
|
36
36
|
diffOutgoingEdges(ctx);
|
|
37
37
|
}
|
|
38
38
|
function diffOutgoingEdges(ctx) {
|
|
39
|
-
const lEdges = new Map(
|
|
40
|
-
const rEdges = new Map(
|
|
39
|
+
const lEdges = new Map(ctx.left.edges());
|
|
40
|
+
const rEdges = new Map(ctx.right.edges());
|
|
41
41
|
if (lEdges.size < rEdges.size && !ctx.config.leftIsSubgraph || lEdges.size > rEdges.size && !ctx.config.rightIsSubgraph) {
|
|
42
42
|
ctx.report.addComment(`Detected different number of edges! ${ctx.leftname} has ${lEdges.size} (${JSON.stringify(lEdges, json_1.jsonReplacer)}). ${ctx.rightname} has ${rEdges.size} ${JSON.stringify(rEdges, json_1.jsonReplacer)}`);
|
|
43
43
|
}
|
|
@@ -131,8 +131,8 @@ function diffFunctionArguments(fn, a, b, ctx) {
|
|
|
131
131
|
}
|
|
132
132
|
function diffVertices(ctx) {
|
|
133
133
|
// collect vertices from both sides
|
|
134
|
-
const lVert =
|
|
135
|
-
const rVert =
|
|
134
|
+
const lVert = ctx.left.vertices(true).map(([id, info]) => [id, info]).toArray();
|
|
135
|
+
const rVert = ctx.right.vertices(true).map(([id, info]) => [id, info]).toArray();
|
|
136
136
|
if (lVert.length < rVert.length && !ctx.config.leftIsSubgraph
|
|
137
137
|
|| lVert.length > rVert.length && !ctx.config.rightIsSubgraph) {
|
|
138
138
|
ctx.report.addComment(`Detected different number of vertices! ${ctx.leftname} has ${lVert.length}, ${ctx.rightname} has ${rVert.length}`);
|
|
@@ -160,13 +160,13 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
160
160
|
*
|
|
161
161
|
* @see #edges
|
|
162
162
|
*/
|
|
163
|
-
vertices(includeDefinedFunctions: boolean):
|
|
163
|
+
vertices(includeDefinedFunctions: boolean): MapIterator<[NodeId, Vertex]>;
|
|
164
164
|
/**
|
|
165
165
|
* @returns the ids of all edges in the graph together with their edge information
|
|
166
166
|
*
|
|
167
167
|
* @see #vertices
|
|
168
168
|
*/
|
|
169
|
-
edges():
|
|
169
|
+
edges(): MapIterator<[NodeId, OutgoingEdges]>;
|
|
170
170
|
/**
|
|
171
171
|
* Returns true if the graph contains a node with the given id.
|
|
172
172
|
*
|
|
@@ -219,7 +219,7 @@ export declare class DataflowGraph<Vertex extends DataflowGraphVertexInfo = Data
|
|
|
219
219
|
/** If you do not pass the `to` node, this will just mark the node as maybe */
|
|
220
220
|
addControlDependency(from: NodeId, to?: NodeId, when?: boolean): this;
|
|
221
221
|
/** Marks the given node as having unknown side effects */
|
|
222
|
-
markIdForUnknownSideEffects(id: NodeId, target?: LinkTo): this;
|
|
222
|
+
markIdForUnknownSideEffects(id: NodeId, target?: LinkTo<RegExp | string>): this;
|
|
223
223
|
/**
|
|
224
224
|
* Constructs a dataflow graph instance from the given JSON data and returns the result.
|
|
225
225
|
* This can be useful for data sent by the flowR server when analyzing it further.
|
package/dataflow/graph/graph.js
CHANGED
|
@@ -335,7 +335,10 @@ class DataflowGraph {
|
|
|
335
335
|
/** Marks the given node as having unknown side effects */
|
|
336
336
|
markIdForUnknownSideEffects(id, target) {
|
|
337
337
|
if (target) {
|
|
338
|
-
this._unknownSideEffects.add({
|
|
338
|
+
this._unknownSideEffects.add({
|
|
339
|
+
id: (0, node_id_1.normalizeIdToNumberIfPossible)(id),
|
|
340
|
+
linkTo: typeof target.callName === 'string' ? { ...target, callName: new RegExp(target.callName) } : target
|
|
341
|
+
});
|
|
339
342
|
return this;
|
|
340
343
|
}
|
|
341
344
|
this._unknownSideEffects.add((0, node_id_1.normalizeIdToNumberIfPossible)(id));
|
package/dataflow/graph/quads.js
CHANGED
|
@@ -11,16 +11,16 @@ const edge_1 = require("./edge");
|
|
|
11
11
|
function df2quads(graph, config) {
|
|
12
12
|
return (0, quads_1.graph2quads)({
|
|
13
13
|
rootIds: [...graph.rootIds()],
|
|
14
|
-
vertices:
|
|
14
|
+
vertices: graph.vertices(true)
|
|
15
15
|
.map(([id, v]) => ({
|
|
16
16
|
...v,
|
|
17
17
|
id
|
|
18
|
-
})),
|
|
19
|
-
edges:
|
|
18
|
+
})).toArray(),
|
|
19
|
+
edges: graph.edges().flatMap(([fromId, targets]) => [...targets].map(([toId, info]) => ({
|
|
20
20
|
from: fromId,
|
|
21
21
|
to: toId,
|
|
22
22
|
type: [...(0, edge_1.edgeTypesToNames)(info.types)],
|
|
23
|
-
})))
|
|
23
|
+
}))).toArray()
|
|
24
24
|
}, config);
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=quads.js.map
|
package/dataflow/info.js
CHANGED
|
@@ -91,7 +91,7 @@ function diffControlDependencies(a, b, info) {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
if (a.length !== b.length) {
|
|
94
|
-
info.report.addComment(`${info.position}Different control dependency lengths: ${a.length} vs. ${b.length}`);
|
|
94
|
+
info.report.addComment(`${info.position}Different control dependency lengths: ${a.length} (${JSON.stringify(a)}) vs. ${b.length} (${JSON.stringify(b)})`);
|
|
95
95
|
}
|
|
96
96
|
for (let i = 0; i < a.length; ++i) {
|
|
97
97
|
diffControlDependency(a[i], b[i], { ...info, position: `${info.position}Control dependency at index: ${i}: ` });
|
|
@@ -7,6 +7,7 @@ import type { AstIdMap, ParentInformation } from '../../r-bridge/lang-4.x/ast/mo
|
|
|
7
7
|
import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexFunctionDefinition, DataflowGraphVertexInfo } from '../graph/vertex';
|
|
8
8
|
import type { BuiltIn } from '../environments/built-in';
|
|
9
9
|
import type { REnvironmentInformation } from '../environments/environment';
|
|
10
|
+
import type { ExitPoint } from '../info';
|
|
10
11
|
export type NameIdMap = DefaultMap<string, IdentifierReference[]>;
|
|
11
12
|
export declare function findNonLocalReads(graph: DataflowGraph, ignore: readonly IdentifierReference[]): IdentifierReference[];
|
|
12
13
|
export declare function produceNameSharedIdMap(references: IdentifierReference[]): NameIdMap;
|
|
@@ -51,3 +52,4 @@ export declare function linkInputs(referencesToLinkAgainstEnvironment: readonly
|
|
|
51
52
|
* `x_2` must get a read marker to `x_1` as `x_1` is the active redefinition in the second loop iteration.
|
|
52
53
|
*/
|
|
53
54
|
export declare function linkCircularRedefinitionsWithinALoop(graph: DataflowGraph, openIns: NameIdMap, outgoing: readonly IdentifierReference[]): void;
|
|
55
|
+
export declare function reapplyLoopExitPoints(exits: readonly ExitPoint[], references: readonly IdentifierReference[]): void;
|
|
@@ -9,6 +9,7 @@ exports.getAllFunctionCallTargets = getAllFunctionCallTargets;
|
|
|
9
9
|
exports.getAllLinkedFunctionDefinitions = getAllLinkedFunctionDefinitions;
|
|
10
10
|
exports.linkInputs = linkInputs;
|
|
11
11
|
exports.linkCircularRedefinitionsWithinALoop = linkCircularRedefinitionsWithinALoop;
|
|
12
|
+
exports.reapplyLoopExitPoints = reapplyLoopExitPoints;
|
|
12
13
|
const defaultmap_1 = require("../../util/collections/defaultmap");
|
|
13
14
|
const assert_1 = require("../../util/assert");
|
|
14
15
|
const log_1 = require("../../util/log");
|
|
@@ -25,7 +26,7 @@ const built_in_1 = require("../environments/built-in");
|
|
|
25
26
|
const prefix_1 = require("../../util/prefix");
|
|
26
27
|
function findNonLocalReads(graph, ignore) {
|
|
27
28
|
const ignores = new Set(ignore.map(i => i.nodeId));
|
|
28
|
-
const ids = new Set(
|
|
29
|
+
const ids = new Set(graph.vertices(true)
|
|
29
30
|
.filter(([_, info]) => info.tag === vertex_1.VertexType.Use || info.tag === vertex_1.VertexType.FunctionCall)
|
|
30
31
|
.map(([id, _]) => id));
|
|
31
32
|
/* find all variable use ids which do not link to a given id */
|
|
@@ -325,4 +326,20 @@ function linkCircularRedefinitionsWithinALoop(graph, openIns, outgoing) {
|
|
|
325
326
|
}
|
|
326
327
|
}
|
|
327
328
|
}
|
|
329
|
+
function reapplyLoopExitPoints(exits, references) {
|
|
330
|
+
// just apply the cds of all exit points not already present
|
|
331
|
+
const exitCds = new Set(exits.flatMap(e => e.controlDependencies).filter(assert_1.isNotUndefined));
|
|
332
|
+
for (const ref of references) {
|
|
333
|
+
for (const cd of exitCds) {
|
|
334
|
+
if (ref.controlDependencies) {
|
|
335
|
+
if (!ref.controlDependencies?.find(c => c.id === cd.id && c.when === cd.when)) {
|
|
336
|
+
ref.controlDependencies.push(cd);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
ref.controlDependencies = [cd];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
328
345
|
//# sourceMappingURL=linker.js.map
|
|
@@ -32,7 +32,9 @@ export interface AssignmentToSymbolParameters<OtherInfo> extends AssignmentConfi
|
|
|
32
32
|
readonly nameOfAssignmentFunction: string;
|
|
33
33
|
readonly source: RNode<OtherInfo & ParentInformation>;
|
|
34
34
|
readonly args: [DataflowInformation, DataflowInformation];
|
|
35
|
-
readonly
|
|
35
|
+
readonly targetId: NodeId;
|
|
36
|
+
/** pass only if the assignment target differs from normal R assignments (i.e., if the symbol is to be resolved) */
|
|
37
|
+
readonly targetName?: string;
|
|
36
38
|
readonly rootId: NodeId;
|
|
37
39
|
readonly data: DataflowProcessorInformation<OtherInfo>;
|
|
38
40
|
readonly information: DataflowInformation;
|
|
@@ -21,6 +21,7 @@ const named_call_handling_1 = require("../named-call-handling");
|
|
|
21
21
|
const built_in_1 = require("../../../../../environments/built-in");
|
|
22
22
|
const unknown_side_effect_1 = require("../../../../../graph/unknown-side-effect");
|
|
23
23
|
const alias_tracking_1 = require("../../../../../eval/resolve/alias-tracking");
|
|
24
|
+
const r_value_1 = require("../../../../../eval/values/r-value");
|
|
24
25
|
function toReplacementSymbol(target, prefix, superAssignment) {
|
|
25
26
|
return {
|
|
26
27
|
type: type_1.RType.Symbol,
|
|
@@ -87,18 +88,57 @@ args, rootId, data, config) {
|
|
|
87
88
|
return (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs: config.forceArgs, origin: 'default' }).information;
|
|
88
89
|
}
|
|
89
90
|
const { type, named } = target;
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
if (type === type_1.RType.Symbol) {
|
|
92
|
+
if (!config.targetVariable) {
|
|
93
|
+
const res = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
94
|
+
name,
|
|
95
|
+
args,
|
|
96
|
+
rootId,
|
|
97
|
+
data,
|
|
98
|
+
reverseOrder: !config.swapSourceAndTarget,
|
|
99
|
+
forceArgs: config.forceArgs,
|
|
100
|
+
origin: 'builtin:assignment'
|
|
101
|
+
});
|
|
102
|
+
return processAssignmentToSymbol({
|
|
103
|
+
...config,
|
|
104
|
+
nameOfAssignmentFunction: name.content,
|
|
105
|
+
source,
|
|
106
|
+
targetId: target.info.id,
|
|
107
|
+
args: getEffectiveOrder(config, res.processedArguments),
|
|
108
|
+
rootId,
|
|
109
|
+
data,
|
|
110
|
+
information: res.information,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// try to resolve the variable first
|
|
115
|
+
const n = (0, alias_tracking_1.resolveIdToValue)(target.info.id, { environment: data.environment, resolve: data.flowrConfig.solver.variables, idMap: data.completeAst.idMap, full: true });
|
|
116
|
+
if (n.type === 'set' && n.elements.length === 1 && n.elements[0].type === 'string') {
|
|
117
|
+
const val = n.elements[0].value;
|
|
118
|
+
if ((0, r_value_1.isValue)(val)) {
|
|
119
|
+
const res = (0, known_call_handling_1.processKnownFunctionCall)({
|
|
120
|
+
name,
|
|
121
|
+
args,
|
|
122
|
+
rootId,
|
|
123
|
+
data,
|
|
124
|
+
reverseOrder: !config.swapSourceAndTarget,
|
|
125
|
+
forceArgs: config.forceArgs,
|
|
126
|
+
origin: 'builtin:assignment'
|
|
127
|
+
});
|
|
128
|
+
return processAssignmentToSymbol({
|
|
129
|
+
...config,
|
|
130
|
+
nameOfAssignmentFunction: name.content,
|
|
131
|
+
source,
|
|
132
|
+
targetId: target.info.id,
|
|
133
|
+
targetName: val.str,
|
|
134
|
+
args: getEffectiveOrder(config, res.processedArguments),
|
|
135
|
+
rootId,
|
|
136
|
+
data,
|
|
137
|
+
information: res.information,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
102
142
|
}
|
|
103
143
|
else if (config.canBeReplacement && type === type_1.RType.FunctionCall && named) {
|
|
104
144
|
/* as replacement functions take precedence over the lhs fn-call (i.e., `names(x) <- ...` is independent from the definition of `names`), we do not have to process the call */
|
|
@@ -127,7 +167,7 @@ args, rootId, data, config) {
|
|
|
127
167
|
...config,
|
|
128
168
|
nameOfAssignmentFunction: name.content,
|
|
129
169
|
source,
|
|
130
|
-
|
|
170
|
+
targetId: rootArg.info.id,
|
|
131
171
|
args: getEffectiveOrder(config, res.processedArguments),
|
|
132
172
|
rootId,
|
|
133
173
|
data,
|
|
@@ -155,12 +195,12 @@ function extractSourceAndTarget(args) {
|
|
|
155
195
|
* Promotes the ingoing/unknown references of target (an assignment) to definitions
|
|
156
196
|
*/
|
|
157
197
|
function produceWrittenNodes(rootId, target, referenceType, data, makeMaybe, value) {
|
|
158
|
-
return
|
|
198
|
+
return target.in.concat(target.unknownReferences).map(ref => ({
|
|
159
199
|
...ref,
|
|
160
200
|
type: referenceType,
|
|
161
201
|
definedAt: rootId,
|
|
162
202
|
controlDependencies: data.controlDependencies ?? (makeMaybe ? [] : undefined),
|
|
163
|
-
value
|
|
203
|
+
value
|
|
164
204
|
}));
|
|
165
205
|
}
|
|
166
206
|
function processAssignmentToString(target, args, name, rootId, data, config, source) {
|
|
@@ -190,7 +230,7 @@ function processAssignmentToString(target, args, name, rootId, data, config, sou
|
|
|
190
230
|
...config,
|
|
191
231
|
nameOfAssignmentFunction: name.content,
|
|
192
232
|
source,
|
|
193
|
-
|
|
233
|
+
targetId: symbol.info.id,
|
|
194
234
|
args: getEffectiveOrder(config, res.processedArguments),
|
|
195
235
|
rootId,
|
|
196
236
|
data,
|
|
@@ -269,19 +309,26 @@ function markAsAssignment(information, nodeToDefine, sourceIds, rootIdOfAssignme
|
|
|
269
309
|
* Helper function whenever it is known that the _target_ of an assignment is a (single) symbol (i.e. `x <- ...`, but not `names(x) <- ...`).
|
|
270
310
|
*/
|
|
271
311
|
function processAssignmentToSymbol(config) {
|
|
272
|
-
const { nameOfAssignmentFunction, source, args: [targetArg, sourceArg],
|
|
312
|
+
const { nameOfAssignmentFunction, source, args: [targetArg, sourceArg], targetId, targetName, rootId, data, information, makeMaybe, quoteSource } = config;
|
|
273
313
|
const referenceType = checkTargetReferenceType(source, sourceArg);
|
|
274
314
|
const aliases = (0, alias_tracking_1.getAliases)([source.info.id], information.graph, information.environment);
|
|
275
|
-
const writeNodes =
|
|
315
|
+
const writeNodes = targetName ? [{
|
|
316
|
+
nodeId: targetId,
|
|
317
|
+
name: targetName,
|
|
318
|
+
type: referenceType,
|
|
319
|
+
definedAt: rootId,
|
|
320
|
+
controlDependencies: data.controlDependencies ?? (makeMaybe ? [] : undefined),
|
|
321
|
+
value: aliases
|
|
322
|
+
}]
|
|
323
|
+
: produceWrittenNodes(rootId, targetArg, referenceType, data, makeMaybe ?? false, aliases);
|
|
276
324
|
if (writeNodes.length !== 1 && log_1.log.settings.minLevel <= 4 /* LogLevel.Warn */) {
|
|
277
325
|
log_1.log.warn(`Unexpected write number in assignment: ${JSON.stringify(writeNodes)}`);
|
|
278
326
|
}
|
|
279
327
|
// we drop the first arg which we use to pass along arguments :D
|
|
280
328
|
const readFromSourceWritten = sourceArg.out.slice(1);
|
|
281
329
|
const readTargets = [
|
|
282
|
-
{ nodeId: rootId, name: nameOfAssignmentFunction, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function }
|
|
283
|
-
|
|
284
|
-
];
|
|
330
|
+
{ nodeId: rootId, name: nameOfAssignmentFunction, controlDependencies: data.controlDependencies, type: identifier_1.ReferenceType.Function }
|
|
331
|
+
].concat(sourceArg.unknownReferences, sourceArg.in, targetName ? targetArg.in : targetArg.in.filter(i => i.nodeId !== targetId), readFromSourceWritten);
|
|
285
332
|
information.environment = (0, overwrite_1.overwriteEnvironment)(sourceArg.environment, targetArg.environment);
|
|
286
333
|
// install assigned variables in environment
|
|
287
334
|
for (const write of writeNodes) {
|
|
@@ -181,8 +181,7 @@ function processExpressionList(name, args, rootId, data) {
|
|
|
181
181
|
graph: nextGraph,
|
|
182
182
|
/* if we have no group, we take the last evaluated expr */
|
|
183
183
|
entryPoint: meId,
|
|
184
|
-
exitPoints:
|
|
185
|
-
: exitPoints
|
|
184
|
+
exitPoints: exitPoints
|
|
186
185
|
};
|
|
187
186
|
}
|
|
188
187
|
//# sourceMappingURL=built-in-expression-list.js.map
|
|
@@ -30,14 +30,13 @@ function processForLoop(name, args, rootId, data) {
|
|
|
30
30
|
const variable = (0, processor_1.processDataflowFor)(variableArg, data);
|
|
31
31
|
// this should not be able to exit always!
|
|
32
32
|
const originalDependency = data.controlDependencies;
|
|
33
|
-
data = { ...data, controlDependencies: [...data.controlDependencies ?? [], { id: name.info.id, when: true }] };
|
|
34
33
|
let headEnvironments = (0, overwrite_1.overwriteEnvironment)(vector.environment, variable.environment);
|
|
35
34
|
const headGraph = variable.graph.mergeWith(vector.graph);
|
|
36
|
-
const writtenVariable =
|
|
35
|
+
const writtenVariable = variable.unknownReferences.concat(variable.in);
|
|
37
36
|
for (const write of writtenVariable) {
|
|
38
37
|
headEnvironments = (0, define_1.define)({ ...write, definedAt: name.info.id, type: identifier_1.ReferenceType.Variable }, false, headEnvironments, data.flowrConfig);
|
|
39
38
|
}
|
|
40
|
-
data = { ...data, environment: headEnvironments };
|
|
39
|
+
data = { ...data, controlDependencies: [...data.controlDependencies ?? [], { id: name.info.id, when: true }], environment: headEnvironments };
|
|
41
40
|
const body = (0, processor_1.processDataflowFor)(bodyArg, data);
|
|
42
41
|
const nextGraph = headGraph.mergeWith(body.graph);
|
|
43
42
|
const outEnvironment = (0, append_1.appendEnvironment)(headEnvironments, body.environment);
|
|
@@ -48,8 +47,9 @@ function processForLoop(name, args, rootId, data) {
|
|
|
48
47
|
nextGraph.addEdge(write.nodeId, vector.entryPoint, edge_1.EdgeType.DefinedBy);
|
|
49
48
|
nextGraph.setDefinitionOfVertex(write);
|
|
50
49
|
}
|
|
51
|
-
const outgoing =
|
|
50
|
+
const outgoing = variable.out.concat(writtenVariable, (0, environment_1.makeAllMaybe)(body.out, nextGraph, outEnvironment, true));
|
|
52
51
|
(0, linker_1.linkCircularRedefinitionsWithinALoop)(nextGraph, nameIdShares, body.out);
|
|
52
|
+
(0, linker_1.reapplyLoopExitPoints)(body.exitPoints, body.in.concat(body.out, body.unknownReferences));
|
|
53
53
|
(0, common_1.patchFunctionCall)({
|
|
54
54
|
nextGraph,
|
|
55
55
|
rootId,
|