errdefer in the right scope

This commit is contained in:
sjorsdonkers
2025-04-22 17:03:44 +02:00
committed by Sjors
parent d666de07a7
commit a1b673175a

View File

@@ -309,10 +309,8 @@ pub fn Env(comptime S: type, comptime types: anytype) type {
} }
const context = v8.Context.init(isolate, global_template, null); const context = v8.Context.init(isolate, global_template, null);
if (kind == .main) { if (kind == .main) context.enter();
context.enter(); errdefer if (kind == .main) context.exit();
errdefer context.exit();
}
// This shouldn't be necessary, but it is: // This shouldn't be necessary, but it is:
// https://groups.google.com/g/v8-users/c/qAQQBmbi--8 // https://groups.google.com/g/v8-users/c/qAQQBmbi--8