fun addSource()

in core/src/main/kotlin/motif/core/State.kt [66:78]


  fun addSource(source: Source) {
    if (sourceToSinks.containsKey(source)) {
      throw IllegalStateException("Source already added.")
    }

    sourceToSinks[source] = LinkedHashSet()

    val matchingSinks: Set<Sink> = sinks[source.type] ?: LinkedHashSet()

    matchingSinks.forEach { matchingSink -> satisfy(matchingSink, source) }

    irTypeToSources.computeIfAbsent(source.type.type) { LinkedHashSet() }.add(source)
  }