diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/js_ast.zig | 11 | ||||
-rw-r--r-- | src/js_printer.zig | 10 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig index 58f5efae2..cdf7a3ad9 100644 --- a/src/js_ast.zig +++ b/src/js_ast.zig @@ -2176,7 +2176,7 @@ pub const E = struct { return @ptrCast([*]const u16, @alignCast(@alignOf(u16), this.data.ptr))[0..this.data.len]; } - pub fn resovleRopeIfNeeded(this: *String, allocator: std.mem.Allocator) void { + pub fn resolveRopeIfNeeded(this: *String, allocator: std.mem.Allocator) void { if (this.next == null or !this.isUTF8()) return; var str = this.next; var bytes = std.ArrayList(u8).initCapacity(allocator, this.rope_len) catch unreachable; @@ -2191,7 +2191,7 @@ pub const E = struct { } pub fn slice(this: *String, allocator: std.mem.Allocator) []const u8 { - this.resovleRopeIfNeeded(allocator); + this.resolveRopeIfNeeded(allocator); return this.string(allocator) catch unreachable; } @@ -2419,6 +2419,7 @@ pub const E = struct { } if (part.tail.len() > 0) { + head.data.e_string.resolveRopeIfNeeded(allocator); head.data.e_string.push(Expr.init(E.String, part.tail, part.tail_loc).data.e_string); } @@ -2445,7 +2446,7 @@ pub const E = struct { if (parts.items.len == 0) { parts.deinit(); - head.data.e_string.resovleRopeIfNeeded(allocator); + head.data.e_string.resolveRopeIfNeeded(allocator); return head; } @@ -5157,8 +5158,8 @@ pub const Expr = struct { switch (right) { .e_string => |r| { equality.ok = true; - r.resovleRopeIfNeeded(allocator); - l.resovleRopeIfNeeded(allocator); + r.resolveRopeIfNeeded(allocator); + l.resolveRopeIfNeeded(allocator); equality.equal = r.eql(E.String, l); }, .e_null, .e_undefined => { diff --git a/src/js_printer.zig b/src/js_printer.zig index 2a68135c1..e6d04a7c0 100644 --- a/src/js_printer.zig +++ b/src/js_printer.zig @@ -2507,7 +2507,7 @@ fn NewPrinter( } }, .e_string => |e| { - e.resovleRopeIfNeeded(p.options.allocator); + e.resolveRopeIfNeeded(p.options.allocator); p.addSourceMapping(expr.loc); // If this was originally a template literal, print it as one as long as we're not minifying @@ -2541,7 +2541,7 @@ fn NewPrinter( p.print("`"); if (e.head.isPresent()) { - e.head.resovleRopeIfNeeded(p.options.allocator); + e.head.resolveRopeIfNeeded(p.options.allocator); p.printStringContent(&e.head, '`'); } @@ -2551,7 +2551,7 @@ fn NewPrinter( p.printExpr(part.value, .lowest, ExprFlag.None()); p.print("}"); if (part.tail.isPresent()) { - part.tail.resovleRopeIfNeeded(p.options.allocator); + part.tail.resolveRopeIfNeeded(p.options.allocator); p.printStringContent(&part.tail, '`'); } } @@ -3205,7 +3205,7 @@ fn NewPrinter( .e_string => |key| { p.addSourceMapping(_key.loc); if (key.isUTF8()) { - key.resovleRopeIfNeeded(p.options.allocator); + key.resolveRopeIfNeeded(p.options.allocator); p.printSpaceBeforeIdentifier(); var allow_shorthand: bool = true; // In react/cjs/react.development.js, there's part of a function like this: @@ -3453,7 +3453,7 @@ fn NewPrinter( switch (property.key.data) { .e_string => |str| { - str.resovleRopeIfNeeded(p.options.allocator); + str.resolveRopeIfNeeded(p.options.allocator); p.addSourceMapping(property.key.loc); if (str.isUTF8()) { |