fix: don't allow execution of CALL_SUPER twice or in non-construct call
This commit is contained in:
parent
bd548c813a
commit
0064c74ac8
@ -40,6 +40,9 @@ public class InstructionRunner {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private static Value execCallSuper(Environment env, Instruction instr, Frame frame) {
|
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 callArgs = frame.take(instr.get(0));
|
||||||
var superFunc = frame.pop();
|
var superFunc = frame.pop();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user