From e717664c749cf237479147ddecd70a39fc3426f2 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 03:52:21 +0000 Subject: refactor(codegen): share writable variable lookup emitLValue (variable and designator base) and plain assignment repeated the same lookup, enum-or-unknown diagnostic and requireWritable check. Move it into a private lookupWritableSymbol helper. READFILE keeps its own lookup, which has no enum diagnostic. Co-Authored-By: Claude Opus 5.5 --- include/cps/CodeGen.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/cps/CodeGen.h') diff --git a/include/cps/CodeGen.h b/include/cps/CodeGen.h index 7085560..37da034 100644 --- a/include/cps/CodeGen.h +++ b/include/cps/CodeGen.h @@ -123,6 +123,7 @@ class CodeGen { void warnMemberShadow(const std::string &Name, int Line) const; bool prepareSymbolDeclaration(const std::string &Name, bool IsConstant = false); bool requireWritable(const SymbolInfo &Info, const std::string &Name); + const SymbolInfo *lookupWritableSymbol(const std::string &Name); void emitConstantStmt(ConstantStmtAST *Stmt); std::map StringConstants; const TypeInfo *requireStringType(); -- cgit v1.3.1-4-g156e