1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +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

@ -439,7 +439,7 @@ public:
bytecode_to_repeat = move(bytecode);
}
OpCode* get_opcode(MatchState& state) const;
OpCode& get_opcode(MatchState& state) const;
private:
void insert_string(const StringView& view)
@ -449,7 +449,7 @@ private:
empend((ByteCodeValueType)view[i]);
}
ALWAYS_INLINE OpCode* get_opcode_by_id(OpCodeId id) const;
ALWAYS_INLINE OpCode& get_opcode_by_id(OpCodeId id) const;
static OwnPtr<OpCode> s_opcodes[(size_t)OpCodeId::Last + 1];
static bool s_opcodes_initialized;
};