Skip to content

Commit

Permalink
getSinks and getSources will now return an empty set if the given typ…
Browse files Browse the repository at this point in the history
…e does not exist in the graph
  • Loading branch information
Leland Takamine authored and Leland-Takamine committed Dec 2, 2019
1 parent 173c586 commit 56b1729
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/main/kotlin/motif/core/ResolvedGraph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ private class ValidResolvedGraph(

override fun getSources(scope: Scope) = scopeStates.getValue(scope).sourceToSinks.keys.filter { it.scope == scope }

override fun getSinks(type: Type) = graphState.sinks.getValue(type)
override fun getSinks(type: Type) = graphState.sinks[type] ?: emptySet<Sink>()

override fun getSinks(irType: IrType) = graphState.irTypeToSinks.getValue(irType)
override fun getSinks(irType: IrType) = graphState.irTypeToSinks[irType] ?: emptySet<Sink>()

override fun getSources(irType: IrType) = graphState.irTypeToSources.getValue(irType)
override fun getSources(irType: IrType) = graphState.irTypeToSources[irType] ?: emptySet<Source>()

override fun getSinks(scope: Scope) = scopeSinks.computeIfAbsent(scope) {
scopeStates.getValue(scope).sinks.values.flatMap { sinks ->
Expand Down

0 comments on commit 56b1729

Please sign in to comment.