fix test failures

Very weird failures, not 100% sure of the cause; regardless, this fixes
them.
This commit is contained in:
Qwerasd
2025-09-29 11:17:29 -06:00
committed by Mitchell Hashimoto
parent 0388a2b396
commit c57c205672
2 changed files with 9 additions and 2 deletions

View File

@@ -254,7 +254,7 @@ pub fn deinit(self: *Parser) void {
/// Next consumes the next character c and returns the actions to execute. /// Next consumes the next character c and returns the actions to execute.
/// Up to 3 actions may need to be executed -- in order -- representing /// Up to 3 actions may need to be executed -- in order -- representing
/// the state exit, transition, and entry actions. /// the state exit, transition, and entry actions.
pub inline fn next(self: *Parser, c: u8) [3]?Action { pub fn next(self: *Parser, c: u8) [3]?Action {
const effect = table[c][@intFromEnum(self.state)]; const effect = table[c][@intFromEnum(self.state)];
// log.info("next: {x}", .{c}); // log.info("next: {x}", .{c});

View File

@@ -278,7 +278,14 @@ pub fn Stream(comptime Handler: type) type {
return; return;
} }
const actions = self.parser.next(c); // We explicitly inline this call here for performance reasons.
//
// We do this rather than mark Parser.next as inline because doing
// that causes weird behavior in some tests- I'm not sure if they
// miscompile or it's just very counter-intuitive comptime stuff,
// but regardless, this is the easy solution.
const actions = @call(.always_inline, Parser.next, .{ &self.parser, c });
for (actions) |action_opt| { for (actions) |action_opt| {
const action = action_opt orelse continue; const action = action_opt orelse continue;
if (comptime debug) log.info("action: {}", .{action}); if (comptime debug) log.info("action: {}", .{action});