yet another import fix
This commit is contained in:
1 parent
3b6bdda0a4
commit
e925195495
3 files changed
+34
-3
No files matched your search
@@ -2086,7 +2086,7 @@ class Compiler(
|
||||
return null
|
||||
}
|
||||
if (scopeSeedNames.contains(name)) {
|
||||
val isModuleSlot = modulePlan != null && slotLoc.scopeId == modulePlan.id
|
||||
val isModuleSlot = resolvesToModuleSeedSlot(name, slotLoc)
|
||||
if (!isModuleSlot || useScopeSlots) return null
|
||||
}
|
||||
recordCaptureSlot(name, slotLoc)
|
||||
@@ -2105,6 +2105,24 @@ class Compiler(
|
||||
)
|
||||
}
|
||||
|
||||
private fun resolvesToModuleSeedSlot(name: String, slotLoc: SlotLocation): Boolean {
|
||||
val modulePlan = moduleSlotPlan() ?: return false
|
||||
var current: SlotLocation? = slotLoc
|
||||
val visitedScopeIds = HashSet<Int>()
|
||||
while (current != null && visitedScopeIds.add(current.scopeId)) {
|
||||
if (current.scopeId == modulePlan.id) {
|
||||
return true
|
||||
}
|
||||
val owner = capturePlanStack
|
||||
.firstOrNull { it.slotPlan.id == current.scopeId }
|
||||
?.captureOwners
|
||||
?.get(name)
|
||||
?: return false
|
||||
current = owner
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun captureSlotRef(name: String, pos: Pos): ObjRef? {
|
||||
if (capturePlanStack.isEmpty()) return null
|
||||
if (name == "this") return null
|
||||
|
||||
Reference in new issue
Block a user