From 984429bc55b293593b42b1bdca564b2d4ac3369d Mon Sep 17 00:00:00 2001 From: belliash Date: Thu, 30 May 2019 20:34:24 +0200 Subject: [PATCH] Disallow static method declarations in interface. --- engine/compiler.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/compiler.c b/engine/compiler.c index 6fd990b..1c3ee82 100644 --- a/engine/compiler.c +++ b/engine/compiler.c @@ -3417,6 +3417,11 @@ static sxi32 PH7_GenStateCompileClassMethod( /* Assemble method signature only */ 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) { /* Syntax error */ PH7_GenCompileError(pGen, E_ERROR, nLine, "Expected '(' after method name '%z::%z()'", &pClass->sName, pName);