aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/ExpressionGen.cc
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 03:45:06 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 03:58:26 +0000
commit1d2bb133b7a3540aeb81c5f9616cb366aebc919f (patch)
treeb4b90c1d991ad8dd05033dfbdbb18a60a1343cfe /lib/CodeGen/ExpressionGen.cc
parent91e506e404c0d285ec1ec77196e83248c8c77161 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/ExpressionGen.cc')
-rw-r--r--lib/CodeGen/ExpressionGen.cc6
1 files changed, 1 insertions, 5 deletions
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);
}