Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/oxlint/src-js/plugins/lint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { diagnostics, setupContextForFile } from './context.js';
import { registeredRules } from './load.js';
import { ast, initAst, resetSource, setupSourceForFile } from './source_code.js';
import { ast, initAst, resetSourceAndAst, setupSourceForFile } from './source_code.js';
import { assertIs, getErrorMessage } from './utils.js';
import { addVisitorToCompiled, compiledVisitor, finalizeCompiledVisitor, initCompiledVisitor } from './visitor.js';

Expand Down Expand Up @@ -160,6 +160,6 @@ function lintFileImpl(filePath: string, bufferId: number, buffer: Uint8Array | n
afterHooks.length = 0;
}

// Reset source, to free memory
resetSource();
// Reset source and AST, to free memory
resetSourceAndAst();
}
4 changes: 2 additions & 2 deletions apps/oxlint/src-js/plugins/source_code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function initAst(): void {
}

/**
* Reset source after file has been linted, to free memory.
* Reset source and AST after file has been linted, to free memory.
*
* Setting `buffer` to `null` also prevents AST being deserialized after linting,
* at which point the buffer may be being reused for another file.
Expand All @@ -74,7 +74,7 @@ export function initAst(): void {
* With `buffer` set to `null`, accessing `SOURCE_CODE.ast` will still throw, but the error message will be clearer,
* and no danger of an infinite loop due to a circular AST (unlikely but possible).
*/
export function resetSource(): void {
export function resetSourceAndAst(): void {
buffer = null;
sourceText = null;
ast = null;
Expand Down
Loading