diff --git a/lib/parse.js b/lib/parse.js index 737260d..a6cc8e1 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -158,8 +158,9 @@ parse.VariableDeclaration = function parseVariableDeclaration(contract, expressi }; parse.VariableDeclarationTuple = function parseVariableDeclarationTuple(contract, expression) { - parse[expression.init.type] && - parse[expression.init.type](contract, expression.init); + instrumenter.instrumentStatement(contract, expression); + parse[expression.declarations[0].id.type] && + parse[expression.declarations[0].id.type](contract, expression.declarations[0].id); }; parse.WhileStatement = function parseWhileStatement(contract, expression) { diff --git a/test/sources/statements/tuple.sol b/test/sources/statements/tuple.sol index f552e79..9c675fb 100644 --- a/test/sources/statements/tuple.sol +++ b/test/sources/statements/tuple.sol @@ -1,7 +1,13 @@ pragma solidity ^0.4.3; -contract Test { +contract Test { + + function returnTuple() returns (uint x, uint y) { + return (10, 20); + } + function a() { - var(x,y) = (10,20); + var (a, b) = (10, 20); + var (x, y) = returnTuple(); } } \ No newline at end of file diff --git a/test/statements.js b/test/statements.js index 9c150c0..de7f9c9 100644 --- a/test/statements.js +++ b/test/statements.js @@ -101,12 +101,14 @@ describe('generic statements', () => { vm.execute(info.contract, 'a', []).then(events => { const mapping = coverage.generate(events, pathPrefix); assert.deepEqual(mapping[filePath].l, { - 5: 1, + 6: 1, 10: 1, 11: 1 }); assert.deepEqual(mapping[filePath].b, {}); - assert.deepEqual(mapping[filePath].s, {}); + assert.deepEqual(mapping[filePath].s, { + 1: 1, 2: 1, 3: 1 + }); assert.deepEqual(mapping[filePath].f, { - 1: 1, + 1: 1, 2: 1 }); done(); }).catch(done);