aboutsummaryrefslogtreecommitdiff
path: root/src/js_ast.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/js_ast.zig')
-rw-r--r--src/js_ast.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig
index e2717a752..965c17b46 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -268,6 +268,13 @@ pub fn BabyList(comptime Type: type) type {
this.update(list_);
}
+ pub fn fetchPush(this: *ListType, allocator: std.mem.Allocator, value: Type) OOM!*Type {
+ var list_ = this.list();
+ try list_.append(allocator, value);
+ this.update(list_);
+ return this.ptr[list_.items.len - 1];
+ }
+
pub inline fn slice(this: ListType) []Type {
@setRuntimeSafety(false);
return this.ptr[0..this.len];