Skip to content

Commit

Permalink
Use tupleCounter instead of inTuple in JsonAbi::getTupleTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
itamarcps committed Jan 10, 2024
1 parent 2a52cab commit b8723f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/jsonabi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ std::vector<std::string> JsonAbi::getTupleTypes(const std::string& type) {
);
tupleString = tupleString.substr(0, tupleString.size() - 1); // Remove ")"
std::string tmp;
bool inTuple = false; // We need to check if we're inside a tuple, so we don't split on "," inside "(...)".
uint16_t tupleCounter = 0; // We need to check if we're inside a tuple, so we don't split on "," inside "(...)".
for (const char& c : tupleString) {
if (c == '(') inTuple = true;
if (c == ')') inTuple = false;
if (c == ',' && !inTuple) {
if (c == '(') ++tupleCounter;
if (c == ')') --tupleCounter;
if (c == ',' && !tupleCounter) {
types.push_back(tmp);
tmp = "";
} else {
Expand Down

0 comments on commit b8723f6

Please sign in to comment.