Page MenuHomePhabricator

[source maps] Fix remove, insert-after and replace

Authored by wallace on Apr 2 2020, 11:29 AM.



In this diff of mine D77186 I introduce a bug in the replace operation, where I was failing fast by mistake.
Besides, a similar problem existed in the insert-after operation, where it was failing fast.

Finally, the remove operation was wrong, as it was not using the indices provided by the users.

I fixed those issues and added some tests account for cases with multiple elements in these requests.

Diff Detail

Event Timeline

wallace created this revision.Apr 2 2020, 11:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 2 2020, 11:29 AM
wallace updated this revision to Diff 254576.Apr 2 2020, 11:31 AM

fix typos

I think the quarantine is reducing my IQ overall...

labath accepted this revision.Apr 2 2020, 11:37 PM
labath added inline comments.

sorting on reverse iterators causes some head-scratching. I think it would be simpler to just sort normally, and then iterate in reverse (for (int /*not auto*/ index: llvm::reverse(remove_indexes)) ...)

This revision is now accepted and ready to land.Apr 2 2020, 11:37 PM
wallace updated this revision to Diff 254981.Apr 3 2020, 7:14 PM

address comments`

This revision was automatically updated to reflect the committed changes.