Open alcuadrado opened 6 years ago
Yes, this is the unfortunate result of trying to build an AST using tolerant mode. If the toleration extends beyond simple things like missing a semicolon into full parts of the tree missing (like the identifier with the contract name in this case) then we have to guard against that everywhere.
We should check if this is only a problem in the places where we are accessing getText() or requires a much bigger refactoring to handle every possible subnode not existing.
I just wrapped all calls to getText with a function that handles nulls, that should solve your error and several others. Leaving this open to investigate if there are similar issues triggered by more obscure syntax errors.
Thanks for the quick answer and fix fede 🙌🏻
I'll get back to this issue if I find this problem in other cases.
I'm afraid I don't know how to fix this issue, so no PR this time :(
Some invalid sources make the parser fail when building the ast, because this method throws.
For example, this code
contract { function a() return bool {} }
causes that problem.Here's a stack trace of it failing: