Skip to content

Commit 052abd9

Browse files
committed
rename
1 parent a11324a commit 052abd9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export interface Clearable {
22
clear(): void;
33
}
4-
export class ClearableCache {
4+
export class ClearableCacheSet {
55
readonly #caches: Set<WeakRef<Clearable>> = new Set();
66
add(cache: Clearable): void {
77
this.#caches.add(new WeakRef(cache));

src/parser/cache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ClearableCache } from "../cache.ts";
1+
import { ClearableCacheSet } from "../cache.ts";
22

3-
export const cache = new ClearableCache();
3+
export const cache = new ClearableCacheSet();
44

55
// This needs to be called whenever settings or custom dictionary has changed
66
export function clearCache(): void {

src/parser/parser_lib.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { memoize } from "@std/cache/memoize";
22
import { ArrayResult, ArrayResultError } from "../array_result.ts";
3-
import { ClearableCache, Clearable, Lazy } from "../cache.ts";
3+
import { ClearableCacheSet, Clearable, Lazy } from "../cache.ts";
44
import { throwError } from "../misc.ts";
55

66
export type ValueRest<T> = Readonly<{ rest: string; value: T }>;
@@ -9,7 +9,7 @@ export type ParserResult<T> = ArrayResult<ValueRest<T>>;
99
export class Parser<T> {
1010
readonly unmemoizedParser: (src: string) => ParserResult<T>;
1111
readonly rawParser: (src: string) => ParserResult<T>;
12-
static cache: null | ClearableCache = null;
12+
static cache: null | ClearableCacheSet = null;
1313
constructor(parser: (src: string) => ParserResult<T>) {
1414
this.unmemoizedParser = parser;
1515
if (Parser.cache != null) {
@@ -65,16 +65,16 @@ export class Parser<T> {
6565
static addToCache(cache: Clearable): void {
6666
Parser.cache?.add(cache);
6767
}
68-
static startCache(cache: ClearableCache = new ClearableCache()): void {
68+
static startCache(cache: ClearableCacheSet = new ClearableCacheSet()): void {
6969
Parser.cache = cache;
7070
}
7171
static endCache(): void {
7272
Parser.cache = null;
7373
}
74-
static startOrEndCache(cache: null | ClearableCache = null): void {
74+
static startOrEndCache(cache: null | ClearableCacheSet = null): void {
7575
Parser.cache = cache;
7676
}
77-
static inContext<T>(fn: () => T, cache: null | ClearableCache = null): T {
77+
static inContext<T>(fn: () => T, cache: null | ClearableCacheSet = null): T {
7878
const previousCache = Parser.cache;
7979
Parser.startOrEndCache(cache);
8080
const value = fn();

0 commit comments

Comments
 (0)