Skip to content

Commit 3debe0f

Browse files
committed
Remove scopes once done
1 parent 51b13f5 commit 3debe0f

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "astronomical",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"type": "commonjs",
55
"description": "offers a way to query a Javascript AST to find specific patterns using a syntax somewhat similar to XPath.",
66
"scripts": {

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,12 +476,14 @@ function createQuerier() {
476476
state.functionCalls.pop();
477477
}
478478
}, root.scopeId, state, root);
479+
479480
return results;
480481
}
481482

482483
function beginHandle<T extends Record<string, QNode>>(queries: T, path: ASTNode) : Record<keyof T, Result[]> {
483484
const rootPath: NodePath = createNodePath(path, undefined, undefined, undefined, undefined);
484485
const r = travHandle(queries, rootPath);
486+
memo.clear();
485487
return r;
486488
}
487489
return {
@@ -539,7 +541,6 @@ export type Scope = {
539541
id: number;
540542
};
541543

542-
const scopes = new Map<number, Scope | number>();
543544

544545
export type ASTNode = ESTree.Node & {
545546
extra?: {
@@ -565,6 +566,7 @@ type Visitor<T> = {
565566

566567
export default function createTraverser() {
567568
let scopeIdCounter = 0;
569+
const scopes = new Map<number, Scope | number>();
568570
let removedScopes = 0;
569571
const nodePathsCreated: Record<string, number> = {}
570572

0 commit comments

Comments
 (0)