Skip to content

Instantly share code, notes, and snippets.

@drawers
Created September 30, 2023 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drawers/ebb35b315ad8b9e2729031601c620db5 to your computer and use it in GitHub Desktop.
Save drawers/ebb35b315ad8b9e2729031601c620db5 to your computer and use it in GitHub Desktop.
private fun KtNamedDeclaration.isUsed(): Boolean {
if (nameAsSafeName.identifier in namedClasses) return true
val pathSegments = fqName?.pathSegments().orEmpty()
return pathSegments.isNotEmpty() && importedFqNames.any { importedFqName ->
importedFqName.pathSegments().zip(pathSegments).all { it.first == it.second }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment