discard method
void
discard()
Drops an open step from the tree.
Runners use it for steps the framework never executed (a Gherkin step after a skip), which must not show up in Steps at all. Pending blob bodies registered on the dropped step and its children are released.
Implementation
void discard() {
final ctx = _ctx;
final node = _node;
if (ctx == null || node == null) return;
_discardNodeBlobs(<_StepNode>[node]);
if (ctx._stepStack.isNotEmpty && ctx._stepStack.last == node) {
ctx._stepStack.removeLast();
}
final parent = node.parent;
if (parent != null) {
parent.children.remove(node);
} else {
ctx._roots[node.section]?.remove(node);
}
_ctx = null;
_node = null;
}