Smarter reassignFragment on section changes

Avoid unnecessary work on `push` and `pop` that only modify trailing end of array.

Additional tests including complex expressions that use `indexRef` and item value `.`.