Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib/tree/ast/astUtils"

Index

Type aliases

MatchTester

MatchTester: function

Tests matches within this file, using their tree node basis.

Type declaration

MatchTesterMaker

MatchTesterMaker: function

Create a MatchTester to use against this file, caching any parsed or otherwise computed resources.

Type declaration

Functions

allPredicates

  • allPredicates(pe: PathExpression): Predicate[]

applyActionToMatches

  • applyActionToMatches(fh: FileHit, action: function): void

doWithAllMatches

  • Integrate path expressions with project operations to find all matches of a path expression and perform a mutation on them them. Use with care!

    Type parameters

    Parameters

    Returns Promise<P>

    hit record for each matching file

fileHitIterator

fillInSourceLocations

findFileMatches

  • Integrate path expressions with project operations to find all matches and their files

    Parameters

    • p: ProjectAsync

      project

    • parserOrRegistry: FileParser | FileParserRegistry

      parser or parsers to use to parse files

    • globPatterns: GlobOptions

      file glob patterns

    • pathExpression: string | PathExpression

      path expression string or parsed

    • Optional functionRegistry: FunctionRegistry

      registry to look for path expression functions in

    Returns Promise<FileHit[]>

    hits for each file

findMatches

  • Integrate path expressions with project operations to find all matches

    type

    T match type to mix in

    Type parameters

    • T

    Parameters

    • p: ProjectAsync

      project

    • parserOrRegistry: FileParser | FileParserRegistry

      parser or parsers to use to parse files

    • globPatterns: GlobOptions

      file glob patterns

    • pathExpression: string | PathExpression

      path expression string or parsed

    • Optional functionRegistry: FunctionRegistry

      registry to look for path expression functions in

    Returns Promise<Array<MatchResult & T>>

    matches

findParser

findValues

  • Convenient method to find all values of matching nodes-- typically, terminals such as identifiers

    Parameters

    • p: ProjectAsync

      project

    • parserOrRegistry: FileParser | FileParserRegistry

      parser for files

    • globPatterns: GlobOptions

      file glob pattern

    • pathExpression: string | PathExpression

      path expression string or parsed

    • Optional functionRegistry: FunctionRegistry

      registry to look for path expression functions in

    Returns Promise<string[]>

    hit record for each matching file

gatherFromMatches

  • Integrate path expressions with project operations to gather mapped values from all matches. Choose the files with globPatterns; choose the portions of code to match with the pathExpression. Choose what to return based on each match with the mapper function. Returns all of the values returned by the mapper (except undefined).

    Type parameters

    • T

    Parameters

    • p: ProjectAsync

      project

    • parserOrRegistry: FileParser | FileParserRegistry

      parser or parsers to use to parse files

    • globPatterns: GlobOptions

      file glob patterns

    • pathExpression: string | PathExpression

      path expression string or parsed

    • mapper: function

      mapping function from match result to result

    • Optional functionRegistry: FunctionRegistry

      registry to look for path expression functions in

    Returns Promise<T[]>

    matches

isAttributeEqualityPredicate

  • isAttributeEqualityPredicate(p: Predicate): boolean

isNestedPredicate

  • isNestedPredicate(p: Predicate): boolean

literalValues

  • literalValues(pex: PathExpression): string[]
  • Return literal values that must be present in a file for this path expression to match. Return the empty array if there are no literal @values or if we cannot determine whether there may be for this path expression.

    Parameters

    • pex: PathExpression

    Returns string[]

matchIterator

parseFile

zapAllMatches

  • Integrate path expressions with project operations to find all matches of a path expression and zap them. Use with care!

    Type parameters

    Parameters

    Returns Promise<P>

    hit record for each matching file

Generated using TypeDoc