Nolan
01/31/2022, 4:50 PMNolan
01/31/2022, 4:58 PMvar foo = foos[parentKey]?.find { it.typeCode == typeCode }!!
compoundKey.split("/").forEach { key ->
val selectedBar = bars.find { it.barKey == key }!!
val newBars = foo.bars.toMutableList()
newBars.removeAll { it.barKey == key }
newBars += selectedBar
foo = foo.copy(bars = newBars)
}
(sorry, this was hard to obfuscate)Nolan
01/31/2022, 5:00 PMvar tmp$;
var $receiver = tmp$;
var find$result;
var firstOrNull$result;
firstOrNull$break: do {
var tmp$_0;
tmp$_0 = $receiver.iterator();
while (tmp$_0.hasNext()) {
var element = tmp$_0.next();
if (element.typeCode === typeCode) {
firstOrNull$result = element;
break firstOrNull$break;
}
}
firstOrNull$result = null;
} while (false);
find$result = firstOrNull$result;
var foo = {
v: ensureNotNull((tmp$ = closure$foos.get_11rb$(parentKey)) != null ? find$result : null)
};
Nolan
01/31/2022, 5:02 PM$receiver
is undefined when $receiver.iterator()
is called. however, if i change foo
to a val
instead of var
, i don't have this problem. obviously i have to comment out the reassignment for that to compile, but that is the only material change -- it still fails with var
when there is no reassignmentRobert Jaros
01/31/2022, 5:06 PMNolan
01/31/2022, 5:08 PM