From 1d2bb133b7a3540aeb81c5f9616cb366aebc919f Mon Sep 17 00:00:00 2001 From: _ov4 Date: Thu, 22 Oct 2026 03:45:06 +0000 Subject: refactor(codegen): share file keyword filename operand emission EOF, OPENFILE, READFILE and CLOSEFILE each rejected a whole-array filename and then emitted it as a C string. Route them through a private emitFileNameOperand helper; diagnostics are unchanged. WRITEFILE keeps its own combined check. Co-Authored-By: Claude Opus 5.5 --- lib/CodeGen/ExpressionGen.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'lib/CodeGen/ExpressionGen.cc') diff --git a/lib/CodeGen/ExpressionGen.cc b/lib/CodeGen/ExpressionGen.cc index 3377a39..ece055a 100644 --- a/lib/CodeGen/ExpressionGen.cc +++ b/lib/CodeGen/ExpressionGen.cc @@ -225,11 +225,7 @@ Value *CodeGen::emitCall(const std::string &Callee, return Memory->emitRelease(Address, Line); } if (Name == "EOF") { - if (isWholeArrayVar(ArgExprs[0].get())) { - reportError("Cannot use a whole array as the EOF filename"); - return nullptr; - } - Value *FileName = emitCStringExpr(ArgExprs[0].get()); + Value *FileName = emitFileNameOperand(ArgExprs[0].get(), "EOF"); if (!FileName) return nullptr; return Files->emitEof(FileName, Line); } -- cgit v1.3.1-4-g156e