Disallow static method declarations in interface.
The build was successful. Details

This commit is contained in:
Rafal Kupiec 2019-05-30 20:34:24 +02:00
parent 53199cac4e
commit 984429bc55
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
1 changed files with 5 additions and 0 deletions

View File

@ -3417,6 +3417,11 @@ static sxi32 PH7_GenStateCompileClassMethod(
/* Assemble method signature only */ /* Assemble method signature only */
doBody = FALSE; doBody = FALSE;
} }
if(iFlags & PH7_CLASS_ATTR_STATIC && pClass->iFlags & PH7_CLASS_INTERFACE) {
PH7_GenCompileError(pGen, E_ERROR, nLine,
"A method '%z::%z()' cannot be declared as static in an interface",
&pClass->sName, pName);
}
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & PH7_TK_LPAREN) == 0) { if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & PH7_TK_LPAREN) == 0) {
/* Syntax error */ /* Syntax error */
PH7_GenCompileError(pGen, E_ERROR, nLine, "Expected '(' after method name '%z::%z()'", &pClass->sName, pName); PH7_GenCompileError(pGen, E_ERROR, nLine, "Expected '(' after method name '%z::%z()'", &pClass->sName, pName);