remove Layer.replaceWith due to no usage and no tests (#33164)

This commit is contained in:
Yegor 2019-05-28 09:55:32 -07:00 committed by GitHub
parent 20c31e7ac3
commit 8217f4bc8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,39 +125,6 @@ abstract class Layer extends AbstractNode with DiagnosticableTreeMixin {
parent?._removeChild(this);
}
/// Replaces this layer with the given layer in the parent layer's child list.
void replaceWith(Layer newLayer) {
assert(parent != null);
assert(attached == parent.attached);
assert(newLayer.parent == null);
assert(newLayer._nextSibling == null);
assert(newLayer._previousSibling == null);
assert(!newLayer.attached);
newLayer._nextSibling = nextSibling;
if (_nextSibling != null)
_nextSibling._previousSibling = newLayer;
newLayer._previousSibling = previousSibling;
if (_previousSibling != null)
_previousSibling._nextSibling = newLayer;
assert(() {
Layer node = this;
while (node.parent != null)
node = node.parent;
assert(node != newLayer); // indicates we are about to create a cycle
return true;
}());
parent.adoptChild(newLayer);
assert(newLayer.attached == parent.attached);
if (parent.firstChild == this)
parent._firstChild = newLayer;
if (parent.lastChild == this)
parent._lastChild = newLayer;
_nextSibling = null;
_previousSibling = null;
parent.dropChild(this);
assert(!attached);
}
/// Returns the value of [S] that corresponds to the point described by
/// [regionOffset].
///