Rename UNKNOWN to ONCE_OR_MORE

Signed-off-by: Graham <gpe@openrs2.dev>
Graham 5 years ago
parent 8254f3d69f
commit 2cbe6ce8e0
  1. 8
      deob/src/main/java/dev/openrs2/deob/analysis/FieldWriteAnalyzer.kt
  2. 2
      deob/src/main/java/dev/openrs2/deob/analysis/FieldWriteCount.kt

@ -47,7 +47,7 @@ class FieldWriteAnalyzer(
count1 == null && count2 != null -> count2
count2 == null && count1 != null -> count1
count1 == count2 -> count1!!
else -> FieldWriteCount.UNKNOWN
else -> FieldWriteCount.ONCE_OR_MORE
}
}
@ -81,10 +81,10 @@ class FieldWriteAnalyzer(
val count = set.getOrDefault(member, FieldWriteCount.NEVER)
return when {
isThis && count == FieldWriteCount.NEVER -> set.plus(Pair(member, FieldWriteCount.EXACTLY_ONCE))
isThis && count == FieldWriteCount.EXACTLY_ONCE -> set.plus(Pair(member, FieldWriteCount.UNKNOWN))
isThis && count == FieldWriteCount.EXACTLY_ONCE -> set.plus(Pair(member, FieldWriteCount.ONCE_OR_MORE))
// save an allocation if count is already set to UNKNOWN
count == FieldWriteCount.UNKNOWN -> set
else -> set.plus(Pair(member, FieldWriteCount.UNKNOWN))
count == FieldWriteCount.ONCE_OR_MORE -> set
else -> set.plus(Pair(member, FieldWriteCount.ONCE_OR_MORE))
}
}
}

@ -3,5 +3,5 @@ package dev.openrs2.deob.analysis
enum class FieldWriteCount {
NEVER,
EXACTLY_ONCE,
UNKNOWN
ONCE_OR_MORE
}

Loading…
Cancel
Save