aboutsummaryrefslogtreecommitdiff
path: root/include/cps/CodeGen.h
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 03:52:21 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 03:58:26 +0000
commite717664c749cf237479147ddecd70a39fc3426f2 (patch)
tree3db2c715f2b566654d356ccd1e3fd6adbe23c260 /include/cps/CodeGen.h
parent5fdea7e2edd534d15eff95efb33336430d7b4872 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'include/cps/CodeGen.h')
-rw-r--r--include/cps/CodeGen.h1
1 files changed, 1 insertions, 0 deletions
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<const ConstantStmtAST *, SymbolInfo> StringConstants;
const TypeInfo *requireStringType();