aboutsummaryrefslogtreecommitdiff
path: root/src/js_ast.zig
diff options
context:
space:
mode:
authorGravatar Alex Lam S.L <alexlamsl@gmail.com> 2023-01-15 07:37:16 +0200
committerGravatar GitHub <noreply@github.com> 2023-01-14 21:37:16 -0800
commit893ec2fb45ae2b39a28864b6d1c9992a694be9cb (patch)
treed2abba07cefb1d9cad5704ebd5404dddbd465aaa /src/js_ast.zig
parent136014b13a0df0641cd7d8ff29d8cf41fae92622 (diff)
downloadbun-893ec2fb45ae2b39a28864b6d1c9992a694be9cb.tar.gz
bun-893ec2fb45ae2b39a28864b6d1c9992a694be9cb.tar.zst
bun-893ec2fb45ae2b39a28864b6d1c9992a694be9cb.zip
fix life-cycle script execution (#1799)
- change current working directory for workspaces - add `node_modules/.bin` to `PATH` before running
Diffstat (limited to '')
-rw-r--r--src/js_ast.zig23
1 files changed, 7 insertions, 16 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig
index f82eadf74..82c9de809 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -2403,10 +2403,7 @@ pub const Expr = struct {
pub inline fn asString(expr: *const Expr, allocator: std.mem.Allocator) ?string {
if (std.meta.activeTag(expr.data) != .e_string) return null;
-
- const key_str = expr.data.e_string;
-
- return if (key_str.isUTF8()) key_str.data else key_str.string(allocator) catch null;
+ return expr.data.e_string.string(allocator) catch null;
}
pub fn asBool(
@@ -6841,11 +6838,9 @@ pub const Macro = struct {
var p = self.p;
const node_type: JSNode.Tag = JSNode.Tag.names.get(str.data) orelse {
- if (!str.isUTF8()) {
- self.log.addErrorFmt(p.source, tag_expr.loc, p.allocator, "Tag \"{s}\" is invalid", .{strings.toUTF8Alloc(self.p.allocator, str.slice16()) catch unreachable}) catch unreachable;
- } else {
- self.log.addErrorFmt(p.source, tag_expr.loc, p.allocator, "Tag \"{s}\" is invalid", .{str.data}) catch unreachable;
- }
+ self.log.addErrorFmt(p.source, tag_expr.loc, p.allocator, "Tag \"{s}\" is invalid", .{
+ str.string(self.p.allocator) catch unreachable,
+ }) catch unreachable;
return false;
};
@@ -6863,13 +6858,9 @@ pub const Macro = struct {
var p = self.p;
const node_type: JSNode.Tag = JSNode.Tag.names.get(str.data) orelse {
- if (!str.isUTF8()) {
- self.log.addErrorFmt(p.source, tag_expr.loc, p.allocator, "Tag \"{s}\" is invalid", .{
- strings.toUTF8Alloc(self.p.allocator, str.slice16()) catch unreachable,
- }) catch unreachable;
- } else {
- self.log.addErrorFmt(p.source, tag_expr.loc, p.allocator, "Tag \"{s}\" is invalid", .{str.data}) catch unreachable;
- }
+ self.log.addErrorFmt(p.source, tag_expr.loc, p.allocator, "Tag \"{s}\" is invalid", .{
+ str.string(self.p.allocator) catch unreachable,
+ }) catch unreachable;
return false;
};