From c1c7e642492c42b1339376f0f7fa9cbf255fd0a9 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 27 Apr 2026 15:35:10 +0200 Subject: [PATCH] Add two `assume` calls to verify lexer arguments --- src/asm/lexer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index 3f444d17..b710b2b1 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -928,6 +928,8 @@ static void discardLineContinuation() { // Functions to read tokenizable values 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 uint32_t n = 1; while (nextChar() == c) { @@ -1269,6 +1271,8 @@ static uint32_t readGfxConstant() { // Functions to read identifiers and keywords static Token readIdentifier(char firstChar, bool raw) { + assume(startsIdentifier(firstChar)); + std::string identifier(1, firstChar); bool keywordBeforeLocal = false; int tokenType = firstChar == '.' ? T_(LOCAL) : T_(SYMBOL);