Step 24E: isolate interpreter-only capture logic

This commit is contained in:
sergeych committed 2026-02-10 07:58:29 +03:00
1 parent 54ca886753
commit 8b196c7b0c
4 files changed
+6 -1

No files matched your search

@@ -33,6 +33,7 @@ class BlockStatement(
if (captureSlots.isNotEmpty()) {
val applyScope = scope as? ApplyScope
for (capture in captureSlots) {
// Interpreter-only capture resolution; bytecode paths must use captureRecords instead.
val rec = if (applyScope != null) {
applyScope.resolveCaptureRecord(capture.name)
?: applyScope.callScope.resolveCaptureRecord(capture.name)
@@ -7034,6 +7034,7 @@ class Compiler(
val captureBase = captureContext ?: closure
if (captureBase != null && captureSlots.isNotEmpty()) {
for (capture in captureSlots) {
// Interpreter-only capture resolution; bytecode functions do not use resolveCaptureRecord.
val rec = captureBase.resolveCaptureRecord(capture.name)
?: captureBase.raiseSymbolNotFound("symbol ${capture.name} not found")
context.updateSlotFor(capture.name, rec)
@@ -170,6 +170,9 @@ open class Scope(
}
internal fun resolveCaptureRecord(name: String): ObjRecord? {
if (captureRecords != null) {
raiseIllegalState("resolveCaptureRecord is interpreter-only; bytecode captures use captureRecords")
}
return chainLookupIgnoreClosure(name, followClosure = true, caller = currentClassCtx)
}