Skip to content

Commit

Permalink
Merge pull request EOSIO#298 from EOSIO/fix/abidiff_fixes
Browse files Browse the repository at this point in the history
abidiff fixes
  • Loading branch information
larryk85 authored Dec 12, 2018
2 parents 4b348bb + e182a7c commit dc86630
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
create_symlink "eosio-cpp eosio-cpp"
create_symlink "eosio-ld eosio-ld"
create_symlink "eosio-pp eosio-pp"
create_symlink "eosio-abidiff eosio-abidiff"
create_symlink "eosio-abigen eosio-abigen"
create_symlink "eosio-wasm2wast eosio-wasm2wast"
create_symlink "eosio-wast2wasm eosio-wast2wasm"
Expand Down
21 changes: 16 additions & 5 deletions tools/abidiff/eosio-abidiff.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ class abidiff {
std::cout << direction << " struct\n";
std::cout << pretty_print(abi["structs"].at(index)) << "\n";
}


ojson get_base_type(const ojson& abi, const ojson& type) {
for (int i=0; i < abi["types"].size(); i++) {
if (abi["types"].at(i)["new_type_name"] == type)
return abi["types"].at(i)["new_type_name"];
}
return type;
}
void find_structs(const ojson& abi1, const ojson& abi2, char direction) {
for ( int i=0; i < abi1["structs"].size(); i++ ) {
bool found = false;
Expand All @@ -97,11 +104,15 @@ class abidiff {
break;
if (abi1["structs"].at(i)["base"] != abi2["structs"].at(j)["base"])
break;

for (int k=0; k < abi1["structs"].at(i)["fields"].size(); k++)
if (abi1["structs"].at(i)["fields"].at(k) != abi2["structs"].at(j)["fields"].at(k))

bool _found = false;
for (int k=0; k < abi1["structs"].at(i)["fields"].size(); k++) {
if (abi1["structs"].at(i)["fields"].at(k)["name"] != abi2["structs"].at(j)["fields"].at(k)["name"] ||
abi1["structs"].at(i)["fields"].at(k)["type"] != abi2["structs"].at(j)["fields"].at(k)["type"])
break;
found = true;
_found = true;
}
found = _found;
}
}
if (!found)
Expand Down

0 comments on commit dc86630

Please sign in to comment.