From 0881f6881161fc30953b872ae108e5a8d359cb5c Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 03:33:22 +0000 Subject: refactor(codegen): share the READ-mode check of file read and EOF helpers __cps_file_read and __cps_file_eof both emitted the same mode load, comparison and ErrNotRead check after the slot lookup; emit it through FileHandler::emitRequireReadMode instead. Co-Authored-By: Claude Opus 5.5 --- include/cps/FileHandler.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/cps/FileHandler.h') diff --git a/include/cps/FileHandler.h b/include/cps/FileHandler.h index 20ece16..fc754e8 100644 --- a/include/cps/FileHandler.h +++ b/include/cps/FileHandler.h @@ -54,6 +54,7 @@ class FileHandler { llvm::Function *createHelper(const char *Name, llvm::FunctionType *FT); llvm::Value *emitSlotGEP(llvm::GlobalVariable *Table, llvm::Type *ElemTy, llvm::Value *Idx); llvm::Value *emitLookupOrFail(llvm::Value *Name, llvm::Value *Line); + void emitRequireReadMode(llvm::Value *Idx, llvm::Value *Name, llvm::Value *Line); void buildFindFn(); void buildOpenFn(); void buildReadFn(); -- cgit v1.3.1-4-g156e