diff options
author | 2023-05-10 17:59:55 -0700 | |
---|---|---|
committer | 2023-05-10 17:59:55 -0700 | |
commit | 06a03df9a6cce40373146b3dd3724bd5fd7c217b (patch) | |
tree | 3d3b08fcde047387b7f702c8bb40a010aa750560 | |
parent | ed5dd3fee152e617a79214d57822893827e03f30 (diff) | |
download | bun-06a03df9a6cce40373146b3dd3724bd5fd7c217b.tar.gz bun-06a03df9a6cce40373146b3dd3724bd5fd7c217b.tar.zst bun-06a03df9a6cce40373146b3dd3724bd5fd7c217b.zip |
Fix assertion
Diffstat (limited to '')
-rw-r--r-- | src/js_parser.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig index e3d10f3c2..b7ba0eab2 100644 --- a/src/js_parser.zig +++ b/src/js_parser.zig @@ -6593,12 +6593,14 @@ fn NewParser_( var iter = scope.members.iterator(); const allocator = p.allocator; var symbols = p.symbols.items; - const orig_capacity = p.symbols.capacity; - // assert we don't modify the symbols array while iterating + defer { if (comptime Environment.allow_assert) { - assert(orig_capacity == p.symbols.capacity); + // we call `.newSymbol` in this function + // we need to avoid using a potentially re-sized array + // so we assert that the array is in sync assert(symbols.ptr == p.symbols.items.ptr); + assert(symbols.len == p.symbols.items.len); } } |