1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:07:44 +00:00

LibRegex: Make get_opcode() return a reference

Previously this would return a pointer which could be null if the
requested opcode was invalid. This should never be the case though
so let's VERIFY() that instead.
This commit is contained in:
Gunnar Beutner 2021-06-13 22:18:54 +02:00 committed by Ali Mohammad Pur
parent cd49fb0229
commit 281f39073d
4 changed files with 24 additions and 37 deletions

View file

@ -39,19 +39,14 @@ public:
auto& bytecode = regex.parser_result.bytecode;
for (;;) {
auto* opcode = bytecode.get_opcode(state);
if (!opcode) {
dbgln("Wrong opcode... failed!");
return;
}
print_opcode("PrintBytecode", *opcode, state);
auto& opcode = bytecode.get_opcode(state);
print_opcode("PrintBytecode", opcode, state);
out(m_file, "{}", m_debug_stripline);
if (is<OpCode_Exit>(*opcode))
if (is<OpCode_Exit>(opcode))
break;
state.instruction_position += opcode->size();
state.instruction_position += opcode.size();
}
fflush(m_file);