Closed spaceh3ad closed 9 months ago
Can you post the test Solidity file here so I can test locally, please? 🙏
now suddenly I got logs from the surya grap PositionManager.sol | dot -Tpng > Test.png
TypeError: Cannot read properties of undefined (reading 'undefined')
at Object.UsingForDeclaration (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/lib/graph.js:210:44)
at visit (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/node_modules/@solidity-parser/parser/dist/index.cjs.js:37156:30)
at /Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/node_modules/@solidity-parser/parser/dist/index.cjs.js:37150:29
at Array.forEach (<anonymous>)
at visit (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/node_modules/@solidity-parser/parser/dist/index.cjs.js:37150:10)
at Object.visit (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/node_modules/@solidity-parser/parser/dist/index.cjs.js:37162:7)
at _loop (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/lib/graph.js:107:12)
at graph (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/lib/graph.js:226:18)
at Object.handler (/Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/bin/surya:65:19)
at /Users/jan-k/.nvm/versions/node/v16.20.2/lib/node_modules/surya/node_modules/yargs/build/index.cjs:1:8993
@GNSPS I tired to write minimal test for this case but it apparently worked with mapping now. I have trouble providing the minimal sample of when code fails, so I can provide link to my repo. From where the surya grap PositionManager.sol | dot -Tpng > Test.png
is failing with error above.
From the error logs, I suspect the bug might be with the using for declaration and not with mappings. But I'll take a look, thanks! 🙏
Ahhh LOL, figured out quickly. I am not allowing using for declarations outside of contracts! 🙈 Back then it was not permitted in the grammar. I'll fix this.
Done! 😄 👍 Thank you for reporting it!
You can try v0.4.9
Thank you so much! 🎉
I am still not able to generate graphs on contracts with named mappings. I tried all the solutions on different threads but nothing seems to work. Back to manual graphs i guess
Can you post here a Solidity snippet that fails? 🙏
As mentioned in #137 there is an issue generating graphs for contracts that has mappings declared. Using SolidityAuditor extension I was able to generate graph for file without mappings however using cmd not.
surya grap Test.sol | dot -Tpng > Test.png
output produces empty Test.png file.I am using MacOS. Surya version:
0.4.8
Graphviz:9.0.0