Reject non-public interface methods at compile time
Build / AerScript (push) Successful in 42s

This commit is contained in:
2026-10-29 16:32:19 +01:00
parent 4f6dd45058
commit 867bab0302
+4 -2
View File
@@ -3904,8 +3904,10 @@ static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) {
/* Extract the current keyword */ /* Extract the current keyword */
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData); nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
if(nKwrd == PH7_KEYWORD_PRIVATE || nKwrd == PH7_KEYWORD_PROTECTED) { if(nKwrd == PH7_KEYWORD_PRIVATE || nKwrd == PH7_KEYWORD_PROTECTED) {
/* Emit a warning and switch to public visibility */ /* Preserve constant visibility recovery; non-public methods are fatal. */
PH7_GenCompileError(&(*pGen), E_WARNING, pGen->pIn->nLine, "interface: Access type must be public"); PH7_GenCompileError(&(*pGen),
pGen->pIn + 1 < pGen->pEnd && SX_PTR_TO_INT(pGen->pIn[1].pUserData) == PH7_KEYWORD_CONST ? E_WARNING : E_ERROR,
pGen->pIn->nLine, "interface: Access type must be public");
nKwrd = PH7_KEYWORD_PUBLIC; nKwrd = PH7_KEYWORD_PUBLIC;
} }
if(nKwrd == PH7_KEYWORD_PUBLIC) { if(nKwrd == PH7_KEYWORD_PUBLIC) {