Skip to content

Commit

Permalink
userctx: remove getter, allow multiple set
Browse files Browse the repository at this point in the history
  • Loading branch information
krichprollsch committed Apr 23, 2024
1 parent 8528b98 commit 655b9eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
8 changes: 0 additions & 8 deletions src/engines/v8/v8.zig
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,9 @@ pub const Env = struct {
}

pub fn setUserContext(self: *Env, userctx: public.UserContext) anyerror!void {
// you can't replace a user context defined in init.
if (self.nat_ctx.userctx != null) return error.UserContextExists;

self.nat_ctx.userctx = userctx;
}

pub fn getUserContext(self: *Env) ?*public.UserContext {
if (self.nat_ctx.userctx) |*ctx| return ctx;
return null;
}

// load user-defined Types into Javascript environement
pub fn load(self: Env, js_types: []usize) anyerror!void {
var tpls: [gen.Types.len]TPL = undefined;
Expand Down
2 changes: 0 additions & 2 deletions src/interfaces.zig
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ pub fn Env(
userctx: public.UserContext,
) anyerror!void);

assertDecl(T, "getUserContext", fn (self: *T) ?*public.UserContext);

// start()
assertDecl(T, "start", fn (
self: *T,
Expand Down

0 comments on commit 655b9eb

Please sign in to comment.