Page MenuHomePhabricator

Refactor ParseScript to deduplicate error checking.
ClosedPublic

Authored by deadalnix on Apr 28 2018, 00:06.

Details

Summary

This is extracted from D1295 . Refactoring the control flow and adding more logic make it fairly hard to review so this makes for a nice first step.

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jasonbcox added inline comments.
src/core_read.cpp
75 ↗(On Diff #3626)

Goto's give a bad code smell, generally. This implementation looks clean, but we'll have to be vigilant in keeping it that way.

If I was writing this, I would encapsulate the error message code in a function and call that here, followed by a continue;
Is there any downside to doing it this way?

src/core_read.cpp
75 ↗(On Diff #3626)

We need to run some code after each iteration of the loop. C++ just doesn't provide a good way to do this. D's scope(success) would be great, but we don't have this.

This revision is now accepted and ready to land.Apr 28 2018, 23:25
This revision was automatically updated to reflect the committed changes.