diff --git a/lib/parse.js b/lib/parse.js index 4765637..ca053be 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -190,6 +190,7 @@ parse.SourceUnit = function(contract, expression) { parse.ReturnStatement = function(contract, expression) { register.statement(contract, expression); + expression.expression && parse[expression.expression.type] && parse[expression.expression.type](contract, expression.expression, true); }; diff --git a/test/sources/solidity/contracts/return/empty-return.sol b/test/sources/solidity/contracts/return/empty-return.sol new file mode 100644 index 0000000..1d7d541 --- /dev/null +++ b/test/sources/solidity/contracts/return/empty-return.sol @@ -0,0 +1,7 @@ +pragma solidity ^0.5.0; + +contract Test { + function a(uint x) public pure { + return; + } +} diff --git a/test/units/expressions.js b/test/units/expressions.js index b007c29..8c71880 100644 --- a/test/units/expressions.js +++ b/test/units/expressions.js @@ -16,4 +16,9 @@ describe('generic expressions / misc', () => { const info = util.instrumentAndCompile('return/return'); util.report(info.solcOutput.errors); }); + + it('should compile after instrumenting function the returns void', () => { + const info = util.instrumentAndCompile('return/empty-return'); + util.report(info.solcOutput.errors); + }); });