Skip to content

Commit

Permalink
fix mapNs missing visitHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Oct 25, 2024
1 parent a7ba45d commit 54194e0
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ fun MappingVisitor.delegator(delegator: Delegator) = DelegateMappingVisitor(this

fun MappingVisitor.mapNs(nsMap: Map<Namespace, Namespace>) = DelegateMappingVisitor(this, object : Delegator() {

override fun visitHeader(delegate: MappingVisitor, vararg namespaces: String) {
super.visitHeader(delegate, *namespaces.map { nsMap[Namespace(it)]?.name ?: it }.toTypedArray())
}

override fun visitPackage(delegate: MappingVisitor, names: Map<Namespace, PackageName>): PackageVisitor? {
val n = names.mapKeys { nsMap[it.key] ?: it.key }
if (n.isEmpty()) return null
Expand Down

0 comments on commit 54194e0

Please sign in to comment.