@eagleoutice/flowr - v2.15.8
    Preparing search index...

    Class SemanticCfgGuidedVisitor<OtherInfo, ControlFlow, Ast, Dfg, Config>

    This visitor extends on the DataflowAwareCfgGuidedVisitor by dispatching visitors for separate function calls as well, providing more information! In a way, this is the mixin of syntactic and dataflow guided visitation.

    Overwrite the functions starting with on to implement your logic. In general, there is just one special case that you need to be aware of:

    In the context of a function call, flowR may be unsure to which origin the call relates! Consider the following example:

    if(u) foo <- library else foo <- rm
    foo(x)

    Obtaining the origins of the call to foo will return both built-in functions library and rm. The general semantic visitor cannot decide on how to combine these cases, and it is up to your overload of SemanticCfgGuidedVisitor#onDispatchFunctionCallOrigins|onDispatchFunctionCallOrigins to decide how to handle this.

    Use BasicCfgGuidedVisitor#start to start the traversal.

    Type Parameters

    Hierarchy (View Summary)

    Index
    config: Config
    visited: Map<NodeId, number>
    • The logical the call's only argument resolves to, undefined if the call does not take exactly one argument or if that argument does not resolve to a single logical.

      Parameters

      Returns boolean | undefined

    • Fires for every assignment call, e.g. <- in x <- 42, assign("x", 42), or the data.table assign := in DT[, x := 42]. Replacements with a function call on the target side, like names(x) <- 3, go through SemanticCfgGuidedVisitor#onReplacementCall|onReplacementCall instead.

      Parameters

      Returns void

    • Fires for every named call not handled by a specific overload, e.g. foo(x) for a user-defined foo. flowR does not care about the dataflow impact of these (currently); use SemanticCfgGuidedVisitor#getOrigins|getOrigins to get the call's origins. Anonymous calls, which cannot be resolved via the active environment, go through SemanticCfgGuidedVisitor#onUnnamedCall|onUnnamedCall instead.

      Parameters

      Returns void

    • Fires for every expression list, implicit or explicit, other than the root program (see SemanticCfgGuidedVisitor#onProgram|onProgram for that) - e.g. the { } block, or the implicit list x <- x + 1 forms in for(x in 1:10) x <- x + 1.

      Parameters

      Returns void

    • Fires for every call to get, e.g. get("x"), which is used to access variables in the global environment. As flowR resolves get during the dataflow analysis, this may also trigger SemanticCfgGuidedVisitor#onVariableUse|onVariableUse.

      Parameters

      Returns void

    • Fires for every call that replaces a value in a container, e.g. names in names(x) <- 3 (but not for x <- 3). Unlike SemanticCfgGuidedVisitor#onAssignmentCall|onAssignmentCall, this does not assign a value to a variable.

      Parameters

      Returns void

    • Fires for every anonymous call, e.g. (function(x) { x + 1 })(42) or the second call in a()(), whose target cannot be inferred from a name (use SemanticCfgGuidedVisitor#getOrigins|getOrigins). Named calls go through SemanticCfgGuidedVisitor#onDefaultFunctionCall|onDefaultFunctionCall instead.

      Parameters

      Returns void