aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2021-11-11 20:35:57 +0100
committerJonas Herzig <jonas@spark-squared.com>2021-11-11 21:39:05 +0100
commit42abaaa0994ee5d0cc900e1f819605b88185f64f (patch)
tree6d6a929c28f7e8712a8ec82c2506e97cf20f0ca7
parent982982c63027e416bd78ca40708c7238e7eed26b (diff)
downloadRemap-42abaaa0994ee5d0cc900e1f819605b88185f64f.tar.gz
Remap-42abaaa0994ee5d0cc900e1f819605b88185f64f.tar.bz2
Remap-42abaaa0994ee5d0cc900e1f819605b88185f64f.zip
Fix `valid(PsiElement)` method
We seem to no longer be relying on it too much. There are still a few issues which have gone unnoticed due to this bug but those will be fixed in the following commits.
-rw-r--r--src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
index f7b50ba..7e8162f 100644
--- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
+++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt
@@ -55,14 +55,7 @@ internal class PsiMapper(
}
}
- private fun valid(e: PsiElement): Boolean {
- val range = e.textRange
- // FIXME This implementation is technically wrong but some parts of the
- // remapper now rely on that, so fixing it is non-trivial.
- // For a proper implementation see the TextRange version below.
- val before = changes.ceilingKey(range)
- return before == null || !before.intersects(range)
- }
+ private fun valid(e: PsiElement): Boolean = valid(e.textRange)
private fun valid(range: TextRange): Boolean {
val before = changes.floorKey(range) ?: TextRange.EMPTY_RANGE