From e04fe64a826fa0642e9fa91faaae898d488f8156 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Thu, 19 Jan 2023 16:19:15 -0800 Subject: [PATCH] Add a comment --- src/js_ast.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js_ast.zig b/src/js_ast.zig index 11ff6e82f9..350bf6561c 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -117,6 +117,12 @@ pub fn NewBaseStore(comptime Union: anytype, comptime count: usize) type { return used; } + /// Reset all AST nodes, allowing the memory to be reused for the next parse. + /// Only call this when we're done with ALL AST nodes, or you risk + /// undefined memory bugs. + /// + /// Nested parsing should either use the same store, or call + /// Store.reclaim. pub fn reset() void { const blocks = _self.overflow.slice(); for (blocks) |b| {