Skip to content

Commit

Permalink
fix(engine): fix a bug in the removal of reactions with a global outp…
Browse files Browse the repository at this point in the history
…ut context
  • Loading branch information
DanySK committed May 13, 2024
1 parent 0b35cdd commit c296e2e
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,22 +111,22 @@ class JGraphTDependencyGraph<T>(private val environment: Environment<T, *>) :
}

override fun removeDependencies(reaction: Actionable<T>) {
check(graph.removeVertex(reaction)) {
BugReporting.reportBug(
"Reaction does not exists in the dependency graph.",
mapOf(
"reaction" to reaction,
"graph" to graph,
"incarnation" to environment.incarnation,
"environment" to environment,
),
)
}
check(reaction.inputContext != Context.GLOBAL || inGlobals.remove(reaction)) {
"Inconsistent state: $reaction, with global input context, was not in the appropriate pool."
}
check(reaction.outputContext != Context.GLOBAL || !outGlobals.remove(reaction)) {
"Inconsistent state: $reaction, with global output context, was not in the appropriate pool."
fun bugInfo() = mapOf(
"reaction" to reaction,
"graph" to graph,
"incarnation" to environment.incarnation,
"environment" to environment,
)
fun bug(message: String): Nothing =
BugReporting.reportBug(message, bugInfo())
if (!graph.removeVertex(reaction)) {
bug("Reaction does not exists in the dependency graph.")
}
if (reaction.inputContext == Context.GLOBAL && !inGlobals.remove(reaction)) {
bug("Inconsistent state: $reaction, with global input context, was not in the appropriate pool.")
}
if (reaction.outputContext == Context.GLOBAL && !inGlobals.remove(reaction)) {
bug("Inconsistent state: $reaction, with global input context, was not in the appropriate pool.")
}
runtimeRemovalCache += reaction
}
Expand Down

0 comments on commit c296e2e

Please sign in to comment.