fun getUsageCount()

in intellij/src/main/kotlin/motif/intellij/ScopeHierarchyUtils.kt [121:138]


  fun getUsageCount(
      project: Project,
      graph: ResolvedGraph,
      clazz: PsiClass,
      includeSources: Boolean = true,
      includeSinks: Boolean = true,
  ): Int {
    var count = 0
    val elementType: PsiType = PsiElementFactory.SERVICE.getInstance(project).createType(clazz)
    val type: IrType = IntelliJType(project, elementType)
    if (includeSources) {
      graph.getSources(type).forEach { _ -> count++ }
    }
    if (includeSinks) {
      graph.getSinks(type).forEach { _ -> count++ }
    }
    return count
  }