ctx: *JSContext,
in_function_body: bool,
byte_code: []u8,
// byte_code: u8
};
fn js_new_function_def(ctx: *JSContext) JSFunctionDef {
// const byte_code = allocator.alloc(u8, @sizeOf(DynBuf));
const byte_code = try allocator.alloc(u8, 2);
std.debug.print("THE BYTECODE {any}", .{byte_code});
// std.debug.print("AFTER ALLOC");
// @compileLog(byte_code);
var fd = JSFunctionDef{
.ctx = ctx,
.in_function_body = false,
.byte_code = &byte_code
// .byte_code = 1
};
return fd;
}```
is giving me
./src/main.zig:718:23: error: expected type 'JSFunctionDef', found 'std.mem.Allocator.Error'
const byte_code = try allocator.alloc(u8, 2);
^
I'm trying to change the byte_code type so that I can get an error instead of the expected type and print that, but it's not working so well for me