Skip to content

Commit 5769d2d

Browse files
committed
dont actually lazy
1 parent 7e91ca8 commit 5769d2d

File tree

2 files changed

+9
-34
lines changed

2 files changed

+9
-34
lines changed

src/commonMain/kotlin/xyz/wagyourtail/unimined/mapping/tree/MemoryMappingTree.kt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,34 +152,12 @@ class MemoryMappingTree : AbstractMappingTree() {
152152
val nameMap = it.names.toMutableMap()
153153
NameCopyDelegate.fillAllNames(toFill, nameMap)
154154
it.setNames(nameMap)
155-
listOf(
156-
async {
157-
it.fields.resolve()
158-
},
159-
async {
160-
it.methods.resolve()
161-
},
162-
async {
163-
it.wildcards.resolve()
164-
}
165-
).awaitAll()
166155
for (fill in toFill) {
167156
it.acceptInner(
168157
DelegateClassVisitor(it, NameCopyDelegate(fill)),
169158
namespaces,
170159
false
171160
)
172-
listOf(
173-
async {
174-
it.fields.resolve()
175-
},
176-
async {
177-
it.methods.resolve()
178-
},
179-
async {
180-
it.wildcards.resolve()
181-
}
182-
).awaitAll()
183161
}
184162
}
185163
}

src/commonMain/kotlin/xyz/wagyourtail/unimined/mapping/tree/node/LazyResolvables.kt

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@ import xyz.wagyourtail.unimined.mapping.tree.AbstractMappingTree
66
import xyz.wagyourtail.unimined.mapping.visitor.BaseVisitor
77

88
class LazyResolvables<T: BaseVisitor<T>, U>(val mappings: AbstractMappingTree) where U: LazyResolvableEntry<U, T>, U: BaseNode<T, *> {
9-
private val unresolved = mutableListOf<U>()
109
private val resolved = mutableListOf<U>()
1110

1211
val lock = SynchronizedObject()
1312

1413
fun resolve(): List<U> {
15-
if (unresolved.isEmpty()) return resolved
14+
return resolved.toList()
15+
}
16+
17+
fun addUnresolved(element: U) {
1618
synchronized(lock) {
17-
if (unresolved.isEmpty()) return resolved
18-
while (unresolved.isNotEmpty()) {
19-
val u = unresolved.removeFirst()
19+
var unresolved: U? = element
20+
while (unresolved != null) {
21+
val u = unresolved
22+
unresolved = null
2023
var merged = false
2124
for (entry in resolved) {
2225
if (u.merge(entry)) {
2326
merged = true
24-
unresolved.add(0, entry)
27+
unresolved = entry
2528
resolved.remove(entry)
2629
break
2730
}
@@ -30,13 +33,7 @@ class LazyResolvables<T: BaseVisitor<T>, U>(val mappings: AbstractMappingTree) w
3033
resolved.add(u)
3134
}
3235
}
33-
unresolved.clear()
3436
}
35-
return resolved
36-
}
37-
38-
fun addUnresolved(element: U) {
39-
unresolved.add(element)
4037
}
4138

4239
}

0 commit comments

Comments
 (0)