duaraghav8 / soltar

Generate Solidity Code from its AST
https://www.npmjs.com/package/soltar
MIT License
15 stars 7 forks source link

Fails with `GENERATOR_OBJECT[item.type] is not a function` #11

Open dmdque opened 6 years ago

dmdque commented 6 years ago

I'm trying to set this up, using the AST generated from solparse with this file, but I get the following error:

/Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:342
                                        GENERATOR_OBJECT [item.type] (item),
                                                                     ^

TypeError: GENERATOR_OBJECT[item.type] is not a function
    at /Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:342:35
    at Array.forEach (<anonymous>)
    at CodeGenerator.ContractStatement (/Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:339:14)
    at /Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:830:34
    at Array.forEach (<anonymous>)
    at CodeGenerator.Program (/Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:825:13)
    at CodeGenerator.generateStatement (/Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:219:26)
    at CodeGenerator.generate (/Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:228:15)
    at Object.generate (/Users/danielque/git/cryptofin-solidity/node_modules/soltar/index.js:1474:4)
    at Object.<anonymous> (/Users/danielque/git/cryptofin-solidity/test.js:105:31)

Without being familiar with the code, this is perhaps caused by lack of support for these?

duaraghav8 commented 6 years ago

Hey @dmdque, this project is no longer maintained so I'm afraid I can't help out much here. Your issue is most likely caused because solidity-parser (whose ASTs soltar supports) was updated with new nodes (like the ones you listed) but soltar hasn't been been updated to handle the same.