Skip to content

Commit b10e46a

Browse files
committed
refactor: add toFunction
1 parent 1004075 commit b10e46a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/kotlin/spp/protocol/artifact/ArtifactQualifiedName.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,16 @@ data class ArtifactQualifiedName(
143143
parent
144144
}
145145
}
146+
147+
fun toFunction(): ArtifactQualifiedName? {
148+
return if (type == ArtifactType.FUNCTION) {
149+
this
150+
} else {
151+
var parent = asParent()
152+
while (parent != null && parent.type != ArtifactType.FUNCTION) {
153+
parent = parent.asParent()
154+
}
155+
parent
156+
}
157+
}
146158
}

0 commit comments

Comments
 (0)