Step 24E: isolate interpreter-only capture logic
This commit is contained in:
parent
54ca886753
commit
8b196c7b0c
@ -105,7 +105,7 @@ Goal: migrate the compiler so all values live in frames/bytecode, keeping JVM te
|
||||
- [ ] Avoid `ClosureScope` in bytecode-related call paths (Block/Lambda/ObjDynamic/ObjProperty).
|
||||
- [ ] Keep interpreter path using `ClosureScope` until interpreter removal.
|
||||
- [ ] JVM tests must be green before commit.
|
||||
- [ ] Step 24E: Isolate interpreter-only capture logic.
|
||||
- [x] Step 24E: Isolate interpreter-only capture logic.
|
||||
- [ ] Mark `resolveCaptureRecord` paths as interpreter-only.
|
||||
- [ ] Guard or delete any bytecode path that tries to sync captures into scopes.
|
||||
- [ ] JVM tests must be green before commit.
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user