Skip to content

Commit

Permalink
Fix bug. unboundStacktrace was not always recorded
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitabobko committed Dec 9, 2024
1 parent c61d93b commit 57803b1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Sources/AppBundle/tree/TreeNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class TreeNode: Equatable {
let index = _parent._children.remove(element: self) ?? errorT("Can't find child in its parent")
check(_parent._mruChildren.remove(self))
self._parent = nil
unboundStacktrace = getStringStacktrace()

return BindingData(parent: _parent, adaptiveWeight: adaptiveWeight, index: index)
}
Expand All @@ -114,13 +115,7 @@ class TreeNode: Equatable {

@discardableResult
func unbindFromParent() -> BindingData {
let bindingData = unbindIfBound()
if let bindingData {
unboundStacktrace = getStringStacktrace()
return bindingData
} else {
error("\(self) is already unbound. The stacktrace where it was unbound:\n\(unboundStacktrace ?? "nil")")
}
unbindIfBound() ?? errorT("\(self) is already unbound. The stacktrace where it was unbound:\n\(unboundStacktrace ?? "nil")")
}

static func == (lhs: TreeNode, rhs: TreeNode) -> Bool {
Expand Down

0 comments on commit 57803b1

Please sign in to comment.