Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Scope

Hierarchy

  • Scope

Index

Constructors

constructor

  • Parameters

    Returns Scope

Properties

bindings

bindings: {}

Type declaration

block

block: Node

hub

hub: Hub

parent

parent: Scope

parentBlock

parentBlock: Node

path

path: NodePath

Methods

addGlobal

  • addGlobal(node: Node): void
  • Parameters

    Returns void

bindingIdentifierEquals

  • bindingIdentifierEquals(name: string, node: Node): boolean
  • Parameters

    • name: string
    • node: Node

    Returns boolean

buildUndefinedNode

  • buildUndefinedNode(): Node
  • Returns Node

checkBlockScopedCollisions

  • checkBlockScopedCollisions(local: Node, kind: string, name: string, id: object): void
  • Parameters

    • local: Node
    • kind: string
    • name: string
    • id: object

    Returns void

dump

  • dump(): void
  • Returns void

generateDeclaredUidIdentifier

  • generateDeclaredUidIdentifier(name?: undefined | string): Identifier
  • Generate a unique identifier and add it to the current scope.

    Parameters

    • Optional name: undefined | string

    Returns Identifier

generateUid

  • generateUid(name?: undefined | string): string
  • Generate a unique _id1 binding.

    Parameters

    • Optional name: undefined | string

    Returns string

generateUidIdentifier

  • generateUidIdentifier(name?: undefined | string): Identifier
  • Generate a unique identifier.

    Parameters

    • Optional name: undefined | string

    Returns Identifier

generateUidIdentifierBasedOnNode

  • generateUidIdentifierBasedOnNode(parent: Node, defaultName?: undefined | string): Identifier
  • Generate a unique identifier based on a node.

    Parameters

    • parent: Node
    • Optional defaultName: undefined | string

    Returns Identifier

getAllBindings

  • getAllBindings(...kinds: string[]): object
  • Walks the scope tree and gathers all bindings.

    Parameters

    • Rest ...kinds: string[]

    Returns object

getBinding

  • getBinding(name: string): Binding | undefined
  • Parameters

    • name: string

    Returns Binding | undefined

getBindingIdentifier

  • Parameters

    • name: string

    Returns Identifier

getBlockParent

  • getBlockParent(): Scope
  • Returns Scope

getData

  • getData(key: string): any
  • Parameters

    • key: string

    Returns any

getFunctionParent

  • getFunctionParent(): Scope | null
  • Returns Scope | null

getOwnBinding

  • getOwnBinding(name: string): Binding | undefined
  • Parameters

    • name: string

    Returns Binding | undefined

getOwnBindingIdentifier

  • getOwnBindingIdentifier(name: string): Identifier
  • Parameters

    • name: string

    Returns Identifier

getProgramParent

  • getProgramParent(): Scope
  • Returns Scope

hasBinding

  • hasBinding(name: string, noGlobals?: undefined | false | true): boolean
  • Parameters

    • name: string
    • Optional noGlobals: undefined | false | true

    Returns boolean

hasGlobal

  • hasGlobal(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

hasOwnBinding

  • hasOwnBinding(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

hasReference

  • hasReference(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

hasUid

  • hasUid(name: string): boolean
  • Parameters

    • name: string

    Returns boolean

isPure

  • isPure(node: Node, constantsOnly?: undefined | false | true): boolean
  • Parameters

    • node: Node
    • Optional constantsOnly: undefined | false | true

    Returns boolean

isStatic

  • isStatic(node: Node): boolean
  • Determine whether evaluating the specific input node is a consequenceless reference. ie. evaluating it wont result in potentially arbitrary code from being ran. The following are whitelisted and determined not to cause side effects:

    • this expressions
    • super expressions
    • Bound identifiers

    Parameters

    Returns boolean

maybeGenerateMemoised

  • maybeGenerateMemoised(node: Node, dontPush?: undefined | false | true): Identifier
  • Possibly generate a memoised identifier if it is not static and has consequences.

    Parameters

    • node: Node
    • Optional dontPush: undefined | false | true

    Returns Identifier

moveBindingTo

  • moveBindingTo(name: string, scope: Scope): void
  • Move a binding of name to another scope.

    Parameters

    • name: string
    • scope: Scope

    Returns void

parentHasBinding

  • parentHasBinding(name: string, noGlobals?: undefined | false | true): boolean
  • Parameters

    • name: string
    • Optional noGlobals: undefined | false | true

    Returns boolean

push

  • push(opts: { id: t.LVal; init?: t.Expression; kind?: "var" | "let" | "const"; unique?: undefined | false | true }): void
  • Parameters

    • opts: { id: t.LVal; init?: t.Expression; kind?: "var" | "let" | "const"; unique?: undefined | false | true }
      • id: t.LVal
      • Optional init?: t.Expression
      • Optional kind?: "var" | "let" | "const"
      • Optional unique?: undefined | false | true

    Returns void

registerBinding

  • Parameters

    Returns void

registerConstantViolation

  • registerConstantViolation(path: NodePath): void
  • Parameters

    Returns void

registerDeclaration

  • registerDeclaration(path: NodePath): void
  • Parameters

    Returns void

removeBinding

  • removeBinding(name: string): void
  • Parameters

    • name: string

    Returns void

removeData

  • removeData(key: string): void
  • Parameters

    • key: string

    Returns void

removeOwnBinding

  • removeOwnBinding(name: string): void
  • Parameters

    • name: string

    Returns void

rename

  • rename(oldName: string, newName?: undefined | string, block?: Node): void
  • Parameters

    • oldName: string
    • Optional newName: undefined | string
    • Optional block: Node

    Returns void

setData

  • setData(key: string, val: any): any
  • Parameters

    • key: string
    • val: any

    Returns any

toArray

  • toArray(node: Node, i?: undefined | number): Node
  • Parameters

    • node: Node
    • Optional i: undefined | number

    Returns Node

traverse

  • Traverse node with current scope and path.

    Type parameters

    • S

    Parameters

    Returns void

  • Parameters

    Returns void