summaryrefslogtreecommitdiff
path: root/src/Addon.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Addon.zig')
-rw-r--r--src/Addon.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Addon.zig b/src/Addon.zig
index 16c38758..398ec415 100644
--- a/src/Addon.zig
+++ b/src/Addon.zig
@@ -343,7 +343,12 @@ fn listed(data: []const u8, path: []const u8, n: usize, why: *Why) Loaded {
/// library loaded at the first pane of its kind, from the file the start
/// listed it from (`listed`); null, and why, when it will not load.
pub fn need(r: *Kind.Registry, k: u8, why: *Why) ?*const Kind.Ops {
- if (r.ops[k] != null or tape.replaying()) return r.ops[k];
+ if (r.ops[k] != null) return r.ops[k];
+ // A client's: its own code for a plain kind, loaded at its first pane.
+ if (tape.replaying()) {
+ r.ops[k] = plainOps(&r.kinds[k]);
+ return r.ops[k];
+ }
const e = &r.kinds[k];
for (found[0..nfound], 0..) |*l, i| if (l.why.len == 0 and std.mem.eql(u8, &l.hash, &e.hash) and std.mem.eql(u8, l.path, e.path.slice())) {
if (l.ops == 0) l.ops = loadListed(i, why) orelse return null;
@@ -617,7 +622,8 @@ pub fn take(r: *Kind.Registry, l: Loaded, except: []const u8) ?[]const u8 {
}
e.why.set("loaded");
// A client's: its own code for a plain kind, or none (the session's).
- r.ops[r.n] = if (tape.replaying()) plainOps(e) else @ptrFromInt(l.ops);
+ // A client's code for a plain kind is loaded at its first pane (`need`).
+ r.ops[r.n] = if (tape.replaying()) null else @ptrFromInt(l.ops);
for (l.words) |w| {
r.words[r.nwords] = .{ .kind = r.n, .arg = w.arg, .opens = w.opens };
r.words[r.nwords].name.set(w.name);