made last changes KMP compliant
This commit is contained in:
1 parent
311cf6ee44
commit
c140567e0c
2 files changed
+26
-10
No files matched your search
@@ -436,6 +436,12 @@ class Compiler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun rememberModuleReferencePos(name: String, pos: Pos) {
|
||||||
|
if (!moduleReferencePosByName.containsKey(name)) {
|
||||||
|
moduleReferencePosByName[name] = pos
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun predeclareClassMembers(target: MutableSet<String>, overrides: MutableMap<String, Boolean>) {
|
private fun predeclareClassMembers(target: MutableSet<String>, overrides: MutableMap<String, Boolean>) {
|
||||||
val saved = cc.savePos()
|
val saved = cc.savePos()
|
||||||
var depth = 0
|
var depth = 0
|
||||||
@@ -948,7 +954,7 @@ class Compiler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
captureLocalRef(name, slotLoc, pos)?.let { ref ->
|
captureLocalRef(name, slotLoc, pos)?.let { ref ->
|
||||||
moduleReferencePosByName.putIfAbsent(name, pos)
|
rememberModuleReferencePos(name, pos)
|
||||||
resolutionSink?.reference(name, pos)
|
resolutionSink?.reference(name, pos)
|
||||||
return ref
|
return ref
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1048,7 @@ class Compiler(
|
|||||||
moduleEntry.isDelegated
|
moduleEntry.isDelegated
|
||||||
)
|
)
|
||||||
captureLocalRef(name, moduleLoc, pos)?.let { ref ->
|
captureLocalRef(name, moduleLoc, pos)?.let { ref ->
|
||||||
moduleReferencePosByName.putIfAbsent(name, pos)
|
rememberModuleReferencePos(name, pos)
|
||||||
resolutionSink?.reference(name, pos)
|
resolutionSink?.reference(name, pos)
|
||||||
return ref
|
return ref
|
||||||
}
|
}
|
||||||
@@ -1069,7 +1075,7 @@ class Compiler(
|
|||||||
strictSlotRefs
|
strictSlotRefs
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
moduleReferencePosByName.putIfAbsent(name, pos)
|
rememberModuleReferencePos(name, pos)
|
||||||
resolutionSink?.reference(name, pos)
|
resolutionSink?.reference(name, pos)
|
||||||
return ref
|
return ref
|
||||||
}
|
}
|
||||||
@@ -1104,7 +1110,7 @@ class Compiler(
|
|||||||
val slot = lookupSlotLocation(name)
|
val slot = lookupSlotLocation(name)
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
captureLocalRef(name, slot, pos)?.let { ref ->
|
captureLocalRef(name, slot, pos)?.let { ref ->
|
||||||
moduleReferencePosByName.putIfAbsent(name, pos)
|
rememberModuleReferencePos(name, pos)
|
||||||
resolutionSink?.reference(name, pos)
|
resolutionSink?.reference(name, pos)
|
||||||
return ref
|
return ref
|
||||||
}
|
}
|
||||||
@@ -1131,7 +1137,7 @@ class Compiler(
|
|||||||
strictSlotRefs
|
strictSlotRefs
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
moduleReferencePosByName.putIfAbsent(name, pos)
|
rememberModuleReferencePos(name, pos)
|
||||||
resolutionSink?.reference(name, pos)
|
resolutionSink?.reference(name, pos)
|
||||||
return ref
|
return ref
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7664,7 +7664,9 @@ class BytecodeCompiler(
|
|||||||
private fun noteScopeSlotRef(slot: Int, pos: Pos) {
|
private fun noteScopeSlotRef(slot: Int, pos: Pos) {
|
||||||
if (slot >= scopeSlotCount) return
|
if (slot >= scopeSlotCount) return
|
||||||
val key = scopeKeyByIndex.getOrNull(slot) ?: return
|
val key = scopeKeyByIndex.getOrNull(slot) ?: return
|
||||||
scopeSlotRefPosByKey.putIfAbsent(key, pos)
|
if (!scopeSlotRefPosByKey.containsKey(key)) {
|
||||||
|
scopeSlotRefPosByKey[key] = pos
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun resolveSlot(ref: LocalSlotRef): Int? {
|
private fun resolveSlot(ref: LocalSlotRef): Int? {
|
||||||
@@ -7675,11 +7677,15 @@ class BytecodeCompiler(
|
|||||||
val localIndex = localSlotIndexByKey[key]
|
val localIndex = localSlotIndexByKey[key]
|
||||||
if (localIndex != null) return scopeSlotCount + localIndex
|
if (localIndex != null) return scopeSlotCount + localIndex
|
||||||
scopeSlotMap[key]?.let {
|
scopeSlotMap[key]?.let {
|
||||||
scopeSlotRefPosByKey.putIfAbsent(key, ref.pos())
|
if (!scopeSlotRefPosByKey.containsKey(key)) {
|
||||||
|
scopeSlotRefPosByKey[key] = ref.pos()
|
||||||
|
}
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
scopeSlotIndexByName[ref.name]?.let {
|
scopeSlotIndexByName[ref.name]?.let {
|
||||||
scopeSlotRefPosByKey.putIfAbsent(key, ref.pos())
|
if (!scopeSlotRefPosByKey.containsKey(key)) {
|
||||||
|
scopeSlotRefPosByKey[key] = ref.pos()
|
||||||
|
}
|
||||||
return it
|
return it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7693,7 +7699,9 @@ class BytecodeCompiler(
|
|||||||
}
|
}
|
||||||
val resolved = scopeSlotMap[scopeKey]
|
val resolved = scopeSlotMap[scopeKey]
|
||||||
if (resolved != null) {
|
if (resolved != null) {
|
||||||
scopeSlotRefPosByKey.putIfAbsent(scopeKey, ref.pos())
|
if (!scopeSlotRefPosByKey.containsKey(scopeKey)) {
|
||||||
|
scopeSlotRefPosByKey[scopeKey] = ref.pos()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return resolved
|
return resolved
|
||||||
}
|
}
|
||||||
@@ -7708,7 +7716,9 @@ class BytecodeCompiler(
|
|||||||
val scopeKey = ScopeSlotKey(refScopeId(ref), refSlot(ref))
|
val scopeKey = ScopeSlotKey(refScopeId(ref), refSlot(ref))
|
||||||
val resolved = scopeSlotMap[scopeKey]
|
val resolved = scopeSlotMap[scopeKey]
|
||||||
if (resolved != null) {
|
if (resolved != null) {
|
||||||
scopeSlotRefPosByKey.putIfAbsent(scopeKey, ref.pos())
|
if (!scopeSlotRefPosByKey.containsKey(scopeKey)) {
|
||||||
|
scopeSlotRefPosByKey[scopeKey] = ref.pos()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return resolved
|
return resolved
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user