Block non-bytecode Statements in bytecode calls

This commit is contained in:
Sergey Chernov 2026-02-12 17:51:40 +03:00
parent db4f7d0973
commit 4cd8e5ded2

View File

@ -1576,6 +1576,12 @@ class CmdCallDirect(
?: error("CALL_DIRECT expects ObjRef at $id") ?: error("CALL_DIRECT expects ObjRef at $id")
val callee = ref.value val callee = ref.value
val args = frame.buildArguments(argBase, argCount) val args = frame.buildArguments(argBase, argCount)
if (callee is Statement) {
val bytecodeBody = (callee as? BytecodeBodyProvider)?.bytecodeBody()
if (callee !is BytecodeStatement && callee !is BytecodeCallable && bytecodeBody == null && isAstStatement(callee)) {
frame.ensureScope().raiseIllegalState("bytecode runtime cannot call non-bytecode Statement")
}
}
val result = if (PerfFlags.SCOPE_POOL) { val result = if (PerfFlags.SCOPE_POOL) {
frame.ensureScope().withChildFrame(args) { child -> callee.callOn(child) } frame.ensureScope().withChildFrame(args) { child -> callee.callOn(child) }
} else { } else {