aboutsummaryrefslogtreecommitdiff
path: root/src/js_ast.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-05-13 17:44:50 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-05-13 17:44:50 -0700
commitca4120afec54fc20295a4a7d3ce6f8c29eccd84c (patch)
tree6619890c616bde65b3798b28fb99018b1eac71e3 /src/js_ast.zig
parent2eb09c1fec3a11067066602e2d6613e817a06630 (diff)
downloadbun-ca4120afec54fc20295a4a7d3ce6f8c29eccd84c.tar.gz
bun-ca4120afec54fc20295a4a7d3ce6f8c29eccd84c.tar.zst
bun-ca4120afec54fc20295a4a7d3ce6f8c29eccd84c.zip
bug fixes galore
Former-commit-id: 72439452918caa05a32d4e3607910901fa2f4f85
Diffstat (limited to 'src/js_ast.zig')
-rw-r--r--src/js_ast.zig14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/js_ast.zig b/src/js_ast.zig
index 66954a5bb..eb7f41ffd 100644
--- a/src/js_ast.zig
+++ b/src/js_ast.zig
@@ -361,7 +361,7 @@ pub const G = struct {
flags: Flags.Function = Flags.Function.None,
};
pub const Arg = struct {
- ts_decorators: ?ExprNodeList = null,
+ ts_decorators: ExprNodeList = &([_]Expr{}),
binding: BindingNodeIndex,
default: ?ExprNodeIndex = null,
@@ -951,7 +951,11 @@ pub const E = struct {
}
pub fn string(s: *String, allocator: *std.mem.Allocator) !string {
- return try std.unicode.utf16leToUtf8Alloc(allocator, s.value);
+ if (s.isUTF8()) {
+ return s.utf8;
+ } else {
+ return strings.toUTF8Alloc(allocator, s.value);
+ }
}
pub fn jsonStringify(s: *const String, options: anytype, writer: anytype) !void {
@@ -1011,16 +1015,16 @@ pub const E = struct {
};
pub const Require = struct {
- import_record_index: Ref.Int = 0,
+ import_record_index: u32 = 0,
};
pub const RequireOrRequireResolve = struct {
- import_record_index: Ref.Int = 0,
+ import_record_index: u32 = 0,
};
pub const Import = struct {
expr: ExprNodeIndex,
- import_record_index: Ref.Int,
+ import_record_index: u32,
// Comments inside "import()" expressions have special meaning for Webpack.
// Preserving comments inside these expressions makes it possible to use