Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 70 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
"@types/command-line-usage": "^5.0.4",
"@types/commonmark": "^0.27.10",
"@types/dagre": "^0.7.53",
"@types/lzma-native": "^4.0.4",
"@types/n-readlines": "^1.0.6",
"@types/n3": "^1.26.0",
"@types/object-hash": "^3.0.6",
Expand All @@ -200,6 +201,7 @@
"@eagleoutice/tree-sitter-r": "^1.1.2",
"@jupyterlab/nbformat": "^4.5.0",
"@xmldom/xmldom": "^0.9.7",
"bzip2": "^0.1.1",
"clipboardy": "^4.0.0",
"command-line-args": "^6.0.1",
"command-line-usage": "^7.0.3",
Expand All @@ -208,6 +210,8 @@
"gray-matter": "^4.0.3",
"joi": "^18.0.1",
"lz-string": "^1.5.0",
"lzma-native": "^8.0.6",
"lzma1": "^0.3.0",
"n-readlines": "^1.0.1",
"n3": "^1.23.1",
"object-hash": "^3.0.0",
Expand All @@ -222,5 +226,9 @@
"web-tree-sitter": "^0.24.7",
"ws": "^8.18.0",
"xpath-ts2": "^1.4.2"
},
"main": "vitest.config.js",
"directories": {
"test": "test"
}
}
22 changes: 14 additions & 8 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@
* Whether source calls should be ignored, causing {@link processSourceCall}'s behavior to be skipped
*/
readonly ignoreSourceCalls: boolean
/**
* Whether load calls should be ignored, causing {@link processLoadCall}'s behavior to be skipped
*/
readonly ignoreLoadCalls: boolean
/** Configure language semantics and how flowR handles them */
readonly semantics: {
/** Semantics regarding the handling of the environment */
Expand All @@ -110,13 +114,13 @@
}
}
}
/** Configuration options for the REPL */
readonly repl: {
/** Whether to show quick stats in the REPL after each evaluation */
quickStats: boolean
/** This instruments the dataflow processors to count how often each processor is called */
dfProcessorHeat: boolean;
}
/** Configuration options for the REPL */
readonly repl: {
/** Whether to show quick stats in the REPL after each evaluation */
quickStats: boolean

Check failure on line 120 in src/config.ts

View workflow job for this annotation

GitHub Actions / 👩‍🏫 Linting (local)

Missing space before value for key 'quickStats'
/** This instruments the dataflow processors to count how often each processor is called */
dfProcessorHeat: boolean;
}
readonly project: {
/** Whether to resolve unknown paths loaded by the r project disk when trying to source/analyze files */
resolveUnknownPathsOnDisk: boolean
Expand Down Expand Up @@ -243,6 +247,7 @@

export const defaultConfigOptions: FlowrConfigOptions = {
ignoreSourceCalls: false,
ignoreLoadCalls: false,
semantics: {
environment: {
overwriteBuiltIns: {
Expand Down Expand Up @@ -292,6 +297,7 @@

export const flowrConfigFileSchema = Joi.object({
ignoreSourceCalls: Joi.boolean().optional().description('Whether source calls should be ignored, causing {@link processSourceCall}\'s behavior to be skipped.'),
ignoreLoadCalls: Joi.boolean().optional().description('Whether load calls should be ignored, causing {@link processLoadCall}\'s behavior to be skipped.'),
semantics: Joi.object({
environment: Joi.object({
overwriteBuiltIns: Joi.object({
Expand Down Expand Up @@ -462,4 +468,4 @@

log.info(`Using default config ${JSON.stringify(defaultConfigOptions)}`);
return defaultConfigOptions;
}
}
4 changes: 4 additions & 0 deletions src/control-flow/semantic-cfg-guided-visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@
case BuiltInProcName.Function:
case BuiltInProcName.FunctionDefinition:
return this.onDefaultFunctionCall({ call });
case BuiltInProcName.Load:
return this.onLoadCall({call});

Check failure on line 316 in src/control-flow/semantic-cfg-guided-visitor.ts

View workflow job for this annotation

GitHub Actions / 👩‍🏫 Linting (local)

A space is required before '}'

Check failure on line 316 in src/control-flow/semantic-cfg-guided-visitor.ts

View workflow job for this annotation

GitHub Actions / 👩‍🏫 Linting (local)

A space is required after '{'
default:
assertUnreachable(origin);
}
Expand Down Expand Up @@ -687,4 +689,6 @@
* @protected
*/
protected onReturnCall(_data: { call: DataflowGraphVertexFunctionCall }) {}

private onLoadCall(_param: { call: DataflowGraphVertexFunctionCall }) {}
}
6 changes: 5 additions & 1 deletion src/dataflow/environments/built-in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import { processRegisterHook } from '../internal/process/functions/call/built-in/built-in-register-hook';
import { processLocal } from '../internal/process/functions/call/built-in/built-in-local';
import { processS3Dispatch } from '../internal/process/functions/call/built-in/built-in-s-three-dispatch';
import { processLoadCall } from '../internal/process/functions/call/built-in/built-in-load';

export type BuiltIn = `built-in:${string}`;

Expand Down Expand Up @@ -224,6 +225,8 @@
Library = 'builtin:library',
/** for `list` calls, see {@link processList} */
List = 'builtin:list',
/** for 'load' calls see {@link processLoadCall} */
Load = 'builtin:load',
/** for `local` calls, see {@link processLocal} */
Local = 'builtin:local',
/** for the pipe operators, see {@link processPipe} */
Expand Down Expand Up @@ -277,6 +280,7 @@
[BuiltInProcName.IfThenElse]: processIfThenElse,
[BuiltInProcName.Library]: processLibrary,
[BuiltInProcName.List]: processList,
[BuiltInProcName.Load]: processLoadCall,
[BuiltInProcName.Local]: processLocal,
[BuiltInProcName.Pipe]: processPipe,
[BuiltInProcName.Quote]: processQuote,
Expand Down Expand Up @@ -336,8 +340,8 @@
type: ReferenceType.BuiltInFunction,
definedAt: id,
cds: undefined,
/* eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument */
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
processor: (name, args, rootId, data) => mappedProcessor(name, args, rootId, data, config as any),

Check failure on line 344 in src/dataflow/environments/built-in.ts

View workflow job for this annotation

GitHub Actions / 👩‍🏫 Linting (local)

Unsafe argument of type `any` assigned to a parameter of type `{ treatIndicesAsString: boolean; } & ForceArguments & BuiltInApplyConfiguration & AssignmentConfiguration & ... 11 more ... & { ...; }`
config,
name,
nodeId: id
Expand Down
3 changes: 2 additions & 1 deletion src/dataflow/environments/default-builtin-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ export const DefaultBuiltinConfig = [
}
}, assumePrimitive: true },
{ type: 'function', names: ['('], processor: BuiltInProcName.Default, config: { returnsNthArgument: 0 }, assumePrimitive: true },
{ type: 'function', names: ['load', 'load_all', 'setwd', 'set.seed'], processor: BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
{ type: 'function', names: ['load'], processor: BuiltInProcName.Load, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
{ type: 'function', names: ['load_all', 'setwd', 'set.seed'], processor: BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: false },
{ type: 'function', names: ['body', 'formals', 'environment'], processor: BuiltInProcName.Default, config: { hasUnknownSideEffects: true, forceArgs: [true] }, assumePrimitive: true },
{ type: 'function',
names: ['.Call', '.External', '.C', '.Fortran'],
Expand Down
2 changes: 2 additions & 0 deletions src/dataflow/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export interface ControlDependency {
readonly when?: boolean
/** whether this control dependency was created due to iteration (e.g., a loop) */
readonly byIteration?: boolean
/** the filepath that caused this dependency (e.g., for load() calls where the file must exist) */
readonly file?: string
}

/**
Expand Down
Loading
Loading