diff options
author | 2022-11-29 23:49:11 -0800 | |
---|---|---|
committer | 2022-11-29 23:49:11 -0800 | |
commit | e75ce84c375cf93b52df3d38450a58f4b1a8346c (patch) | |
tree | 74f5840fee1179350dbe337ce14fbd236adc2984 /src/js_ast.zig | |
parent | b631ea7d725a42954c577ea686ae711ef04f63e1 (diff) | |
download | bun-e75ce84c375cf93b52df3d38450a58f4b1a8346c.tar.gz bun-e75ce84c375cf93b52df3d38450a58f4b1a8346c.tar.zst bun-e75ce84c375cf93b52df3d38450a58f4b1a8346c.zip |
Remove some dead bindings code
Diffstat (limited to '')
-rw-r--r-- | src/js_ast.zig | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig index f6a7ac879..986a7c753 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -7220,20 +7220,18 @@ pub const Macro = struct { return true; }, .e_string => { - var wtf_string = JSC.JSValue.toWTFString(writer.nextJSValue() orelse return false, writer.ctx.ptr()); - if (wtf_string.isEmpty()) { + var str = (writer.nextJSValue() orelse return false).toSlice(writer.ctx.ptr(), writer.allocator); + if (str.len == 0) { expr.* = Expr{ .loc = writer.loc, .data = .{ .e_string = &E.String.empty, }, }; - } else if (wtf_string.is8Bit()) { - expr.* = Expr.init(E.String, E.String.init(wtf_string.characters8()[0..wtf_string.length()]), writer.loc); - } else if (wtf_string.is16Bit()) { - expr.* = Expr.init(E.String, E.String.init(wtf_string.characters16()[0..wtf_string.length()]), writer.loc); } else { - unreachable; + expr.* = Expr.init(E.String, E.String.init( + (str.cloneIfNeeded(writer.allocator) catch unreachable).slice(), + ), writer.loc); } return true; }, |