Skip to content

⬅️ Back to Table of Contents

📄 WithScope

📊 Analysis Summary

Metric Count
🔧 Functions 1
🧱 Classes 1
📦 Imports 6

📚 Table of Contents

🛠️ File Location:

📂 packages/scope-manager/src/scope/WithScope.ts

📦 Imports

Name Source
TSESTree @typescript-eslint/types
ScopeManager ../ScopeManager
Scope ./Scope
assert ../assert
ScopeBase ./ScopeBase
ScopeType ./ScopeType

Functions

WithScope.close(scopeManager: ScopeManager): Scope | null

Parameters:

  • scopeManager ScopeManager

Returns: Scope | null

Calls:

  • this.shouldStaticallyClose
  • super.close
  • assert (from ../assert)
  • this.leftToResolve.forEach
  • this.delegateToUpperScope
Code
public override close(scopeManager: ScopeManager): Scope | null {
    if (this.shouldStaticallyClose()) {
      return super.close(scopeManager);
    }
    assert(this.leftToResolve);
    this.leftToResolve.forEach(ref => this.delegateToUpperScope(ref));
    this.leftToResolve = null;
    return this.upper;
  }

Classes

WithScope

Extends: `ScopeBase< ScopeType.with, TSESTree.WithStatement, Scope

`

Class Code
export class WithScope extends ScopeBase<
  ScopeType.with,
  TSESTree.WithStatement,
  Scope
> {
  constructor(
    scopeManager: ScopeManager,
    upperScope: WithScope['upper'],
    block: WithScope['block'],
  ) {
    super(scopeManager, ScopeType.with, upperScope, block, false);
  }

  public override close(scopeManager: ScopeManager): Scope | null {
    if (this.shouldStaticallyClose()) {
      return super.close(scopeManager);
    }
    assert(this.leftToResolve);
    this.leftToResolve.forEach(ref => this.delegateToUpperScope(ref));
    this.leftToResolve = null;
    return this.upper;
  }
}

Methods (1) — full entries under Functions

Method Signature
close (scopeManager: ScopeManager): Scope \| null

Generated by Syntax Scribe