Protected ReadonlyconfigProtected ReadonlytraceThe abstract trace of the abstract interpretation visitor mapping node IDs to the abstract state at the respective node.
Protected ReadonlyvisitedProtectedevalEvaluates any access operation call visited by the abstract interpretation visitor by applying the abstract semantics of the access operation to the current abstract stat (e.g. for $, [, [[, ...).
The data flow vertex of the access operation to evaluate
The current abstract state before the evaluation of the access operation
The abstract state after applying the abstract semantics of the access operation
ProtectedevalEvaluates any function call visited by the abstract interpretation visitor by applying the abstract semantics of the function call to the current abstract state.
The data flow vertex of the function call to evaluate
The current abstract state before the evaluation of the function call
The abstract state after applying the abstract semantics of the function call
ProtectedevalEvaluates any replacement function call visited by the abstract interpretation visitor by applying the abstract semantics of the replacement call to the current abstract state (e.g. for $<-, [<-, names<-, ...).
The data flow vertex of the replacement call to evaluate
The node ID of the assigned expression of the replacement call
The node ID of the assignment target of the replacement call
The current abstract state before the evaluation of the replacement call
The abstract state after applying the abstract semantics of the replacement call
Gets the mapped abstract data frame operations for an AST node (this only includes direct function calls, replacement calls, or access operations). This requires that the abstract interpretation visitor has been completed, or at least started.
The ID of the node to get the mapped abstract operations for
The mapped abstract data frame operations for the node, or undefined if no abstract operation was mapped for the node or storing mapped abstract operations is disabled via the visitor config.
Gets the inferred abstract state at the location of a specific AST node. This requires that the abstract interpretation visitor has been completed, or at least started.
The ID of the node to get the abstract state at
The abstract state at the node, or undefined if the node has no abstract state (i.e. the node has not been visited or is unreachable).
Gets the inferred abstract trace mapping AST nodes to the inferred abstract state at the respective node.
The inferred abstract trace of the program
Resolves the inferred abstract value of an AST node. This requires that the abstract interpretation visitor has been completed, or at least started.
The ID of the node to get the inferred value for
Optionalstate: StateAbstractDomain<DataFrameDomain>An optional state abstract domain used to resolve the inferred abstract value (defaults to the state at the requested node)
The inferred abstract value of the node, or undefined if no value was inferred for the node
ProtectedgetGet the control flow vertex for the given node id or fail if it does not exist.
ProtectedgetGet the dataflow graph vertex for the given id
Gets the inferred abstract state at the end of the program (exit nodes of the control flow graph). This requires that the abstract interpretation visitor has been completed, or at least started.
The inferred abstract state at the end of the program
ProtectedgetA helper function to get the normalized AST node for the given id or fail if it does not exist.
ProtectedgetProtectedgetProtectedgetProtectedisWe only perform widening at for, while, or repeat loops with more than one incoming CFG edge
ProtectedonProtectedThis event triggers for every subsetting call, i.e., for every call to [[, [, or $.
ProtectedonProtectedThis event triggers for every call to any of the *apply functions.
For example, lapply in lapply(1:10, function(x) { x + 1 }).
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every assignment call, i.e., for every call to <- or = that assigns a value to a variable.
For example, this triggers for <- in x <- 42 or assign in assign("x", 42).
This also triggers for the data.table assign := active within subsetting calls, e.g., DT[, x := 42].
Please be aware that replacements (e.g. assignments with a function call on the target side) like names(x) <- 3 are subject to SemanticCfgGuidedVisitor#onReplacementCall|onReplacementCall instead.
ProtectedonProtectedonProtectedThis event triggers for every function call that is not handled by a specific overload, and hence may be a function that targets a user-defined function. In a way, these are functions that are named, but flowR does not specifically care about them (currently) wrt. to their dataflow impact.
Use SemanticCfgGuidedVisitor#getOrigins|getOrigins to get the origins of the call.
For example, this triggers for foo(x) in
foo <- function(x) { x + 1 }
foo(x)
This explicitly will not trigger for scenarios in which the function has no name (i.e., if it is anonymous).
For such cases, you may rely on the SemanticCfgGuidedVisitor#onUnnamedCall|onUnnamedCall event.
The main reason for this separation is part of flowR's handling of these functions, as anonymous calls cannot be resolved using the active environment.
ProtectedonProtectedThis function is responsible for dispatching the appropriate event based on a given dataflow vertex. The default serves as a backend for the event functions, but you may overwrite and extend this function at will.
onDispatchFunctionCallOrigins for the aggregation in case the function call target is ambiguous.
ProtectedonProtectedGiven a function call that has multiple targets (e.g., two potential built-in definitions). This function is responsible for calling onDispatchFunctionCallOrigin for each of the origins, and aggregating their results (which is just additive by default). If you want to change the behavior in case of multiple potential function definition targets, simply overwrite this function with the logic you desire.
ProtectedonProtectedonProtectedThis event triggers for every call to the eval function.
For example, eval in eval(parse(text = "x + 1")).
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every expression list - implicit or explicit, but not for the root program (see SemanticCfgGuidedVisitor#onProgram|onProgram for that).
For example, this triggers for the expression list created by { and } in ìf (TRUE) { x <- 1; y <- 2; }. But also for the implicit
expression list x <- x + 1 in for(x in 1:10) x <- x + 1.
ProtectedonProtectedonProtectedThis event triggers for every call to the for loop function, which is used to implement the for loop control flow.
For example, this triggers for for in for(i in 1:10) { print(i) }.
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonCalled for every anonymous function definition.
For example, function(x) { x + 1 } in lapply(1:10, function(x) { x + 1 }).
ProtectedonProtectedThis event triggers for every call to the get function, which is used to access variables in the global environment.
For example, get in get("x").
Please be aware, that with flowR resolving the get during the dataflow analysis,
this may very well trigger a SemanticCfgGuidedVisitor#onVariableUse|onVariableUse event as well.
ProtectedonProtectedThis event triggers for every call to the if function, which is used to implement the if-then-else control flow.
ProtectedonProtectedThis event triggers for every call to a function which loads a library.
For example, library in library(dplyr).
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every call that (to the knowledge of flowr) constructs a (new) list.
For example, this triggers for list in list(1, 2, 3).
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonCalled for every constant logical value in the program.
For example, TRUE in if(TRUE) { ... }.
ProtectedonCalled for every occurrence of a NULL in the program.
For other symbols that are not referenced as a variable, see SemanticCfgGuidedVisitor#onSymbolConstant|onSymbolConstant.
ProtectedonCalled for every constant number value in the program.
For example, 42 in print(42).
ProtectedonProtectedThis event triggers for every call to R's pipe operator, i.e., for every call to |>.
ProtectedonProtectedThis event is called for the root program node, i.e., the program that is being analyzed.
ProtectedonProtectedThis event triggers for every call to the quote function, which is used to quote expressions.
For example, quote in quote(x + 1).
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every call to the repeat loop function, which is used to implement the repeat loop control flow.
For example, this triggers for repeat in repeat { i <- i + 1; if(i >= 10) break }.
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every call to a function that replaces a value in a container, such as names(x) <- 3.
This is different from SemanticCfgGuidedVisitor#onAssignmentCall|onAssignmentCall in that it does not assign a value to a variable,
but rather replaces a value in a container.
For example, this triggers for names in names(x) <- 3, but not for x <- 3.
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every call to the rm function, which is used to remove variables from the environment.
For example, rm in rm(x).
ProtectedonProtectedThis event triggers for every call to the source function.
For example, source in source("script.R").
By default, this does not provide the resolved source file. Yet you can access the DataflowGraph to ask for sourced files.
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedThis event triggers for every call to a special binary operator, i.e., every binary function call that starts and ends with a % sign.
For example, this triggers for%in% in x %in% y.
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedonCalled for every constant string value in the program.
For example, "Hello World" in print("Hello World").
ProtectedonCalled for every constant symbol value in the program.
For example, foo in library(foo) or a in l$a. This most likely happens as part of non-standard-evaluation, i.e., the symbol is not evaluated to a value,
but used as a symbol in and of itself.
Please note, that due to its special behaviors, NULL is handled in SemanticCfgGuidedVisitor#onNullConstant|onNullConstant and not here.
ProtectedonProtectedThis event triggers for every anonymous call within the program.
For example, (function(x) { x + 1 })(42) or the second call in a()().
This is separate from SemanticCfgGuidedVisitor#onDefaultFunctionCall|onDefaultFunctionCall which is used for named function calls that do not trigger any of these events.
The main differentiation for these calls is that you may not infer their semantics from any name alone and probably have
to rely on SemanticCfgGuidedVisitor#getOrigins|getOrigins to get more information.
ProtectedonCalled for every variable that is written within the program. You can use getOrigins to get the origins of the variable.
For example, x in x <- 42 or x in assign("x", 42).
See SemanticCfgGuidedVisitor#onAssignmentCall for the assignment call. This event handler also provides you with information on the source.
ProtectedonCalled for every variable that is read within the program. You can use getOrigins to get the origins of the variable.
For example, x in print(x).
ProtectedonProtectedThis event triggers for every call that (to the knowledge of flowr) constructs a (new) vector.
For example, this triggers for c in c(1, 2, 3).
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedonProtectedonProtectedThis event triggers for every call to the while loop function, which is used to implement the while loop control flow.
For example, this triggers for while in while(i < 10) { i <- i + 1 }.
More specifically, this relates to the corresponding BuiltInProcessorMapper handler.
ProtectedshouldChecks whether to continue visiting the control flow graph after a widening point. By default, we only continue visiting if the widening point is visited for the first time or the abstract state at the widening point changed.
ProtectedshouldChecks whether a control flow graph vertex should be skipped during visitation. By default, we only process vertices of leaf nodes and exit vertices (no entry nodes of complex nodes).
ProtectedshouldWhether widening should be performed at a widening point. By default, we perform widening when the number of visitation of the widening point reaches the widening threshold of the config.
Start the visiting process.
ProtectedstartProtectedvisitProtectedvisitProtectedSee DataflowAwareCfgGuidedVisitor#visitFunctionCall for the base implementation.
This function is called for every function call in the program and dispatches the appropriate event.
You probably do not have to overwrite it and just use SemanticCfgGuidedVisitor#onUnnamedCall|onUnnamedCall for anonymous calls,
or SemanticCfgGuidedVisitor#onDispatchFunctionCallOrigins|onDispatchFunctionCallOrigins for named calls (or just overwrite
the events you are interested in directly).
ProtectedvisitProtectedSee DataflowAwareCfgGuidedVisitor#visitFunctionDefinition for the base implementation.
This function is called for every function definition in the program and dispatches the appropriate event.
You probably do not have to overwrite it and just use SemanticCfgGuidedVisitor#onFunctionDefinition|onFunctionDefinition instead.
Protectedvisitcall this function to indicate that a node is to be considered visited.
true if the node was not visited before, false otherwise
ProtectedvisitProtectedSee DataflowAwareCfgGuidedVisitor#visitUnknown for the base implementation.
This function is called for every unknown vertex in the program.
It dispatches the appropriate event based on the type of the vertex.
In case you have to overwrite this function please make sure to still call this implementation to get a correctly working SemanticCfgGuidedVisitor#onProgram|onProgram.
ProtectedvisitSee DataflowAwareCfgGuidedVisitor#visitValue for the base implementation. This now dispatches the value to the appropriate event handler based on its type.
ProtectedvisitProtectedSee DataflowAwareCfgGuidedVisitor#visitVariableDefinition for the base implementation.
This function is called for every variable definition in the program and dispatches the appropriate event.
You probably do not have to overwrite it and just use SemanticCfgGuidedVisitor#onVariableDefinition|onVariableDefinition instead.
ProtectedvisitProtectedSee DataflowAwareCfgGuidedVisitor#visitVariableUse for the base implementation.
This function is called for every use of a variable in the program and dispatches the appropriate event.
You probably do not have to overwrite it and just use SemanticCfgGuidedVisitor#onVariableUse|onVariableUse instead.
The control flow graph visitor to infer the shape of data frames using abstract interpretation