Add two assume calls to verify lexer arguments

This commit is contained in:
Rangi42
2026-04-27 15:35:10 +02:00
parent a18b2f1049
commit c1c7e64249
+4
View File
@@ -928,6 +928,8 @@ static void discardLineContinuation() {
// Functions to read tokenizable values // Functions to read tokenizable values
static std::string readAnonLabelRef(char c) { static std::string readAnonLabelRef(char c) {
assume(c == '+' || c == '-');
// We come here having already peeked at one char, so no need to do it again // We come here having already peeked at one char, so no need to do it again
uint32_t n = 1; uint32_t n = 1;
while (nextChar() == c) { while (nextChar() == c) {
@@ -1269,6 +1271,8 @@ static uint32_t readGfxConstant() {
// Functions to read identifiers and keywords // Functions to read identifiers and keywords
static Token readIdentifier(char firstChar, bool raw) { static Token readIdentifier(char firstChar, bool raw) {
assume(startsIdentifier(firstChar));
std::string identifier(1, firstChar); std::string identifier(1, firstChar);
bool keywordBeforeLocal = false; bool keywordBeforeLocal = false;
int tokenType = firstChar == '.' ? T_(LOCAL) : T_(SYMBOL); int tokenType = firstChar == '.' ? T_(LOCAL) : T_(SYMBOL);