Skip to content

Commit 83fdf2f

Browse files
committed
Generate leaner rule code
The generator leaves out token checks the surrounding code already guarantees, and builds children with array_slice() now that no reducer pushes a list onto the value stack. Amp-Thread-ID: https://ampcode.com/threads/T-01a17820-94d1-75c8-9206-2e802d9c0556
1 parent 3f975de commit 83fdf2f

5 files changed

Lines changed: 9393 additions & 13125 deletions

File tree

‎src/Parser/AstBuilder.php‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,14 +1057,10 @@ protected function reduceObjectShapeKey(int $begin, int $end, $children): Node
10571057
/**
10581058
* A comment read right after the comma separating the items of a shape is
10591059
* thrown away.
1060-
*
1061-
* @return list<mixed>
10621060
*/
1063-
protected function reduceDiscardedComment(int $begin, int $end): array
1061+
protected function reduceDiscardedComment(int $begin, int $end): void
10641062
{
10651063
unset($this->comments[$begin]);
1066-
1067-
return [];
10681064
}
10691065

10701066
// -------------------------------------------------------------------------

0 commit comments

Comments
 (0)