BlockLevelPass: further fixes for T218817
authorArlo Breault <abreault@wikimedia.org>
Wed, 20 Mar 2019 21:02:39 +0000 (17:02 -0400)
committerArlo Breault <abreault@wikimedia.org>
Wed, 20 Mar 2019 21:31:29 +0000 (17:31 -0400)
commit73239ee9bdb2598ada26c20a1b0009c501b162bc
tree181165e9895518731925769282585a91eecabefe
parent4d7dcf5c963ee39a197b9e02a7aeb09c1f3ac8aa
BlockLevelPass: further fixes for T218817

The previous fix for T218817 (I22eebb70af1b19d7c25241fc78bfcced4470e78a)
was a bit premature: we didn't notice that ExplodeIterator *also*
used a different Iterator::key() than ArrayIterator -- it used
the string position as a key, not the line number.  Combined with
an inequality test for "not the last line" meant that almost every
line was now the "last line" and we were missing a lot of needed
newlines.

Count the lines ourselves to fix the problem.

Bug: T208070
Bug: T218817
Change-Id: I55a2c4c0ec304292162c51aa88b206fea0142392
includes/parser/BlockLevelPass.php