Compare commits

...

1 Commits

Author SHA1 Message Date
Dylan Conway
0d4c7fd06d resolve rope in string() 2023-07-20 16:37:05 -07:00
2 changed files with 3 additions and 3 deletions

View File

@@ -2327,8 +2327,9 @@ pub const E = struct {
strings.eqlComptimeUTF16(s.slice16()[0..value.len], value);
}
pub fn string(s: *const String, allocator: std.mem.Allocator) !bun.string {
pub fn string(s: *String, allocator: std.mem.Allocator) !bun.string {
if (s.isUTF8()) {
s.resolveRopeIfNeeded(allocator);
return s.data;
} else {
return strings.toUTF8Alloc(allocator, s.slice16());

View File

@@ -5141,7 +5141,6 @@ fn NewParser_(
return Expr{ .data = nullExprData, .loc = arg.loc };
}
str.resolveRopeIfNeeded(p.allocator);
const pathname = str.string(p.allocator) catch unreachable;
const path = fs.Path.init(pathname);
@@ -18866,7 +18865,7 @@ fn NewParser_(
p.should_fold_typescript_constant_expressions = true;
for (data.values) |*enum_value| {
// gotta allocate here so it lives after this function stack frame goes poof
const name = enum_value.name;
var name = enum_value.name;
var assign_target: Expr = Expr{ .loc = logger.Loc.Empty, .data = Prefill.Data.EMissing };
var has_string_value = false;