File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
tests/zig_modules/test-module/src Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -61,15 +61,15 @@ pub fn @"export"(comptime value: anytype) void {
6161/// ```
6262pub fn init (comptime f : InitFunction ) void {
6363 const module = opaque {
64- pub fn napi_register_module_v1 (env : c.napi_env , exp : c.napi_value ) callconv (.c ) c.napi_value {
64+ pub fn napi_register_module_v1 (env : c.napi_env , _ : c.napi_value ) callconv (.c ) c.napi_value {
6565 const node = NodeContext .init (env );
6666
6767 const exports = f (node ) catch | err | {
6868 node .handleError (err );
6969 return null ;
7070 };
7171
72- return if ( exports ) | v | v .napi_value else exp ;
72+ return exports .napi_value ;
7373 }
7474 };
7575
@@ -79,7 +79,7 @@ pub fn init(comptime f: InitFunction) void {
7979/// The InitFunction to pass to the `register` method. The `ctx` parameter
8080/// represents the Node context. The returned value becomes the `exports` value
8181/// of the JS module.
82- pub const InitFunction = fn (ctx : NodeContext ) anyerror ! ? NodeValue ;
82+ pub const InitFunction = fn (ctx : NodeContext ) anyerror ! NodeValue ;
8383
8484inline fn registerModule (comptime ptr : * const anyopaque ) void {
8585 @export (ptr , .{ .name = "napi_register_module_v1" });
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ comptime {
1111 node_api .init (init );
1212}
1313
14- fn init (node : node_api.NodeContext ) ! ? node_api.NodeValue {
14+ fn init (node : node_api.NodeContext ) ! node_api.NodeValue {
1515 const ptr = try std .heap .c_allocator .create (WrapTarget );
1616 ptr .* = .{ .foo = 123 , .bar = "hopla" };
1717
You can’t perform that action at this time.
0 commit comments