Exposes the central analyses and information provided by the FlowrAnalyzer to the linter, search, and query APIs. This allows us to exchange the underlying implementation of the analyzer without affecting the APIs.

interface ReadonlyFlowrAnalysisProvider {
    controlflow(
        simplifications?: readonly (
            | "unique-cf-sets"
            | "analyze-dead-code"
            | "remove-dead-code"
            | "to-basic-blocks"
        )[],
        kind?: CfgKind,
        force?: boolean,
    ): Promise<ControlFlowInformation<CfgSimpleVertex>>;
    dataflow(
        force?: boolean,
    ): Promise<DataflowInformation & PipelinePerStepMetaInformation>;
    flowrConfig: FlowrConfigOptions;
    inspectContext(): ReadOnlyFlowrAnalyzerContext;
    normalize(
        force?: boolean,
    ): Promise<
        NormalizedAst<ParentInformation, RNode<ParentInformation>> & PipelinePerStepMetaInformation,
    >;
    parse(
        force?: boolean,
    ): Promise<ParseStepOutput<string | Tree> & PipelinePerStepMetaInformation>;
    parserInformation(): Promise<TreeSitterInformation | RShellInformation>;
    query<
        Types extends
            | "search"
            | "config"
            | "origin"
            | "dataflow"
            | "call-context"
            | "control-flow"
            | "dataflow-lens"
            | "df-shape"
            | "normalized-ast"
            | "id-map"
            | "dataflow-cluster"
            | "static-slice"
            | "lineage"
            | "dependencies"
            | "location-map"
            | "happens-before"
            | "inspect-higher-order"
            | "resolve-value"
            | "project"
            | "linter" = | "search"
        | "config"
        | "origin"
        | "dataflow"
        | "call-context"
        | "control-flow"
        | "dataflow-lens"
        | "df-shape"
        | "normalized-ast"
        | "id-map"
        | "dataflow-cluster"
        | "static-slice"
        | "lineage"
        | "dependencies"
        | "location-map"
        | "happens-before"
        | "inspect-higher-order"
        | "resolve-value"
        | "project"
        | "linter",
    >(
        query: Queries<Types>,
    ): Promise<QueryResults<Types>>;
    runFull(force?: boolean): Promise<void>;
    runSearch<Search extends FlowrSearchLike>(
        search: Search,
    ): Promise<GetSearchElements<SearchOutput<Search>>>;
    sendCommandWithOutput(
        command: string,
        addonConfig?: Partial<OutputCollectorConfiguration>,
    ): Promise<string[]>;
}

Hierarchy (View Summary)

Implemented by

Hierarchy-Diagram

UML class diagram of ReadonlyFlowrAnalysisProvider

Properties

flowrConfig: FlowrConfigOptions

This is the config used for the analyzer

Methods

  • Get the control flow graph (CFG) for the request.

    Parameters

    • Optionalsimplifications: readonly (
          | "unique-cf-sets"
          | "analyze-dead-code"
          | "remove-dead-code"
          | "to-basic-blocks"
      )[]

      Simplification passes to be applied to the CFG.

    • Optionalkind: CfgKind

      The kind of CFG that is requested. By default, the CFG without dataflow information is returned.

    • Optionalforce: boolean

      Do not use the cache, instead force new analyses.

    Returns Promise<ControlFlowInformation<CfgSimpleVertex>>

  • Access the query API for the request.

    Type Parameters

    • Types extends
          | "search"
          | "config"
          | "origin"
          | "dataflow"
          | "call-context"
          | "control-flow"
          | "dataflow-lens"
          | "df-shape"
          | "normalized-ast"
          | "id-map"
          | "dataflow-cluster"
          | "static-slice"
          | "lineage"
          | "dependencies"
          | "location-map"
          | "happens-before"
          | "inspect-higher-order"
          | "resolve-value"
          | "project"
          | "linter" =
          | "search"
          | "config"
          | "origin"
          | "dataflow"
          | "call-context"
          | "control-flow"
          | "dataflow-lens"
          | "df-shape"
          | "normalized-ast"
          | "id-map"
          | "dataflow-cluster"
          | "static-slice"
          | "lineage"
          | "dependencies"
          | "location-map"
          | "happens-before"
          | "inspect-higher-order"
          | "resolve-value"
          | "project"
          | "linter"

    Parameters

    Returns Promise<QueryResults<Types>>

  • This executes all steps of the core analysis (parse, normalize, dataflow).

    Parameters

    • Optionalforce: boolean

    Returns Promise<void>