naddison36 / sol2uml

Solidity contract visualisation tool
MIT License
1.13k stars 268 forks source link

Handle circular import dependencies #96

Closed naddison36 closed 2 years ago

naddison36 commented 2 years ago

sol2uml currently fails to generate diagrams for the Monaco contract that is used in the 0xMonaco on-chain pvp racing game.

The problem is the Monaco.sol file imports the Car.sol file with import "./cars/Car.sol"; and the Cars.sol file has a circular import back to the Monaco.sol file with import "../Monaco.sol";.

sol2uml -b Monaco .    
RangeError: Maximum call stack size exceeded
    at /workspaces/sol2uml/lib/associations.js:7:36
    at Array.find (<anonymous>)
    at findAssociatedClass (/workspaces/sol2uml/lib/associations.js:7:31)
    at findImplicitImport (/workspaces/sol2uml/lib/associations.js:69:58)
    at findAssociatedClass (/workspaces/sol2uml/lib/associations.js:31:12)
    at findImplicitImport (/workspaces/sol2uml/lib/associations.js:69:58)
    at findAssociatedClass (/workspaces/sol2uml/lib/associations.js:31:12)
    at findImplicitImport (/workspaces/sol2uml/lib/associations.js:69:58)
    at findAssociatedClass (/workspaces/sol2uml/lib/associations.js:31:12)
    at findImplicitImport (/workspaces/sol2uml/lib/associations.js:69:58)
naddison36 commented 2 years ago

Fixed for the 2.1.9 release Monaco

naddison36 commented 2 years ago

Fixed in https://github.com/naddison36/sol2uml/releases/tag/v2.1.9