diff --git a/lib/instrumenter.js b/lib/instrumenter.js index 5aab842..338b685 100644 --- a/lib/instrumenter.js +++ b/lib/instrumenter.js @@ -61,6 +61,8 @@ class Instrumenter { // First, we run over the original contract to get the source mapping. let ast = SolidityParser.parse(contract.source, {range: true}); + //console.log(JSON.stringify(ast, null, ' ')) + parse[ast.type](contract, ast); const retValue = JSON.parse(JSON.stringify(contract)); // Possibly apotropaic. diff --git a/lib/parse.js b/lib/parse.js index abffb9a..2e45cde 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -185,6 +185,9 @@ parse.SourceUnit = function(contract, expression) { parse.ReturnStatement = function(contract, expression) { register.statement(contract, expression); + + parse[expression.expression.type] && + parse[expression.expression.type](contract, expression.expression, true); }; // TODO:Investigate node structure diff --git a/test/units/or.js b/test/units/or.js index 0d7ecef..4b59246 100644 --- a/test/units/or.js +++ b/test/units/or.js @@ -159,7 +159,7 @@ describe('logical OR branches', () => { 5: 1, }); assert.deepEqual(mapping[util.filePath].b, { - + 1: [ 1, 0 ] }); assert.deepEqual(mapping[util.filePath].s, { 1: 1, @@ -182,7 +182,7 @@ describe('logical OR branches', () => { 5: 2, }); assert.deepEqual(mapping[util.filePath].b, { - + 1: [ 1, 1 ] }); assert.deepEqual(mapping[util.filePath].s, { 1: 2,