solidity-parser-antlr icon indicating copy to clipboard operation
solidity-parser-antlr copied to clipboard

Fixed transformAST.TypeName

Open ZeframLou opened this issue 5 years ago • 0 comments

In transformAST.TypeName, it is possible for ctx.children to be null. An example scenario is when the last argument of a function definition has a trailing comma.

The existing implementation assumes ctx.children has the property length, which causes an exception when ctx.children is null. This commit fixes this issue by adding an if statement that checks for this condition. If ctx.children is indeed null, the fixed version returns this.visit(ctx.getChild(0)), which is the default return value used in the existing implementation.

ZeframLou avatar Jan 23 '20 05:01 ZeframLou