Skip to content

Commit

Permalink
fix wildcard, skip empty named
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyourtail committed Sep 22, 2024
1 parent daec040 commit c978761
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class MethodNode(parent: ClassNode) : FieldMethodResolvable<MethodNode, MethodVi
exception.accept(visitor, nsFilter)
}
for (param in params.resolve()) {
if (param.names.isEmpty()) continue
param.accept(visitor, nsFilter)
}
for (local in locals) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import xyz.wagyourtail.unimined.mapping.jvms.ext.FieldOrMethodDescriptor
import xyz.wagyourtail.unimined.mapping.jvms.four.ElementType
import xyz.wagyourtail.unimined.mapping.jvms.four.two.one.InternalName
import xyz.wagyourtail.unimined.mapping.tree.node.LazyResolvableEntry
import xyz.wagyourtail.unimined.mapping.tree.node.LazyResolvables
import xyz.wagyourtail.unimined.mapping.tree.node.SignatureNode
import xyz.wagyourtail.unimined.mapping.tree.node._class.ClassNode
import xyz.wagyourtail.unimined.mapping.tree.node._class.member.method.ExceptionNode
Expand All @@ -16,13 +17,14 @@ import xyz.wagyourtail.unimined.mapping.visitor.*
class WildcardNode(parent: ClassNode, val type: WildcardType, descs: Map<Namespace, FieldOrMethodDescriptor>) : MemberNode<WildcardVisitor, ClassVisitor>(parent), WildcardVisitor, LazyResolvableEntry<WildcardNode, WildcardVisitor> {
private val _descs = descs.toMutableMap()
private val _signatures: MutableSet<SignatureNode<WildcardVisitor>> = mutableSetOf()
private val _params: MutableList<ParameterNode<WildcardVisitor>> = mutableListOf()
private val _locals: MutableList<LocalNode<WildcardVisitor>> = mutableListOf()
private val _exceptions: MutableList<ExceptionNode<WildcardVisitor>> = mutableListOf()

val descs: Map<Namespace, FieldOrMethodDescriptor> get() = _descs
val signatures: Set<SignatureNode<WildcardVisitor>> get() = _signatures
val params: List<ParameterNode<WildcardVisitor>> get() = _params
val params = LazyResolvables<ParameterVisitor, ParameterNode<WildcardVisitor>>(root) {
ParameterNode(this, null, null)
}
val locals: List<LocalNode<WildcardVisitor>> get() = _locals
val exceptions: List<ExceptionNode<WildcardVisitor>> get() = _exceptions

Expand Down Expand Up @@ -54,19 +56,9 @@ class WildcardNode(parent: ClassNode, val type: WildcardType, descs: Map<Namespa

override fun visitParameter(index: Int?, lvOrd: Int?, names: Map<Namespace, String>): ParameterVisitor? {
if (type == WildcardType.FIELD) return null
for (param in params) {
if (index != null && param.index == index) {
param.setNames(names)
return param
}
if (lvOrd != null && param.lvOrd == lvOrd) {
param.setNames(names)
return param
}
}
val newParam = ParameterNode(this, index, lvOrd)
newParam.setNames(names)
_params.add(newParam)
params.addUnresolved(newParam)
return newParam
}

Expand Down Expand Up @@ -109,7 +101,8 @@ class WildcardNode(parent: ClassNode, val type: WildcardType, descs: Map<Namespa
for (exception in exceptions) {
exception.accept(visitor, nsFilter)
}
for (param in params) {
for (param in params.resolve()) {
if (param.names.isEmpty()) continue
param.accept(visitor, nsFilter)
}
for (local in locals) {
Expand Down

0 comments on commit c978761

Please sign in to comment.