Skip to content

Commit 655fb79

Browse files
authored
Parse TryStatements and catchClauses (#522)
1 parent 7cb2e41 commit 655fb79

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/parse.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,17 @@ parse.ReturnStatement = function(contract, expression) {
171171
parse[subExpression.argument.type](contract, expression.argument);
172172
};*/
173173

174+
parse.TryStatement = function(contract, expression) {
175+
register.statement(contract, expression);
176+
parse[expression.body.type] &&
177+
parse[expression.body.type](contract, expression.body);
178+
179+
for (let x = 0; x < expression.catchClauses.length; x++) {
180+
parse[expression.catchClauses[x].body.type] &&
181+
parse[expression.catchClauses[x].body.type](contract, expression.catchClauses[x].body);
182+
}
183+
};
184+
174185
parse.UsingStatement = function (contract, expression) {
175186
parse[expression.for.type] &&
176187
parse[expression.for.type](contract, expression.for);

test/integration/projects/solc-6/contracts/ContractA.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ contract ContractA is ContractB {
4343
errorCount++;
4444
return (0, false);
4545
} catch (bytes memory) {
46-
errorCount++;
46+
errorCount = errorCount + 1;
4747
return (0, false);
4848
}
4949
}

test/units/buidler/standard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ describe('Buidler Plugin: standard use cases', function() {
284284
const expected = [
285285
{
286286
file: mock.pathToContract(buidlerConfig, 'ContractA.sol'),
287-
pct: 87.5
287+
pct: 61.54
288288
},
289289
{
290290
file: mock.pathToContract(buidlerConfig, 'ContractB.sol'),

0 commit comments

Comments
 (0)