Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Post commit formatting
  • Loading branch information
lexidor committed May 24, 2023
commit 8176da6515d8ccd62f7735a0f770f54b95ae28f3
18 changes: 9 additions & 9 deletions src/nodes/NodeList.hack
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ final class NodeList<+Titem as Node> extends Node {
return $this->_children;
}

public function getChildrenOfItems<T as ?Node>(
): vec<T> where Titem as ListItem<T> {
public function getChildrenOfItems<T as ?Node>(): vec<T>
where
Titem as ListItem<T> {
return Vec\map($this->getChildren(), $child ==> $child->getItem());
}

Expand Down Expand Up @@ -140,7 +141,7 @@ final class NodeList<+Titem as Node> extends Node {
'source' => $source,
'offset' => $offset,
'width' => $current_position - $offset,
)
),
);
}

Expand Down Expand Up @@ -204,9 +205,8 @@ final class NodeList<+Titem as Node> extends Node {
if (!C\contains($this->_children, $old)) {
return $this;
}
return new NodeList(
Vec\map($this->_children, $c ==> $c === $old ? $new : $c),
);
return
new NodeList(Vec\map($this->_children, $c ==> $c === $old ? $new : $c));
}

public function insertBefore<Tchild super Titem as Node>(
Expand Down Expand Up @@ -252,9 +252,9 @@ final class NodeList<+Titem as Node> extends Node {
return new NodeList($new);
}

public function withoutItemWithChild<Tinner as Node>(
Tinner $inner,
): this where Titem as ListItem<Tinner> {
public function withoutItemWithChild<Tinner as Node>(Tinner $inner): this
where
Titem as ListItem<Tinner> {
$new = Vec\filter($this->_children, $c ==> $c->getItem() !== $inner);
if ($new === $this->_children) {
return $this;
Expand Down