fix: don't allow execution of CALL_SUPER twice or in non-construct call

This commit is contained in:
TopchetoEU 2024-09-21 18:46:02 +03:00
parent bd548c813a
commit 0064c74ac8
Signed by: topchetoeu
GPG Key ID: 6531B8583E5F6ED4

View File

@ -40,6 +40,9 @@ public class InstructionRunner {
return null;
}
private static Value execCallSuper(Environment env, Instruction instr, Frame frame) {
if (!frame.isNew) throw EngineException.ofError("Super constructor may be called only when constructing");
if (frame.self != null) throw EngineException.ofError("Super constructor may be called once");
var callArgs = frame.take(instr.get(0));
var superFunc = frame.pop();