Parse TryStatements and catchClauses (#522)

pull/523/head
cgewecke 5 years ago committed by GitHub
parent 7cb2e417c2
commit 655fb79530
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      lib/parse.js
  2. 2
      test/integration/projects/solc-6/contracts/ContractA.sol
  3. 2
      test/units/buidler/standard.js

@ -171,6 +171,17 @@ parse.ReturnStatement = function(contract, expression) {
parse[subExpression.argument.type](contract, expression.argument); parse[subExpression.argument.type](contract, expression.argument);
};*/ };*/
parse.TryStatement = function(contract, expression) {
register.statement(contract, expression);
parse[expression.body.type] &&
parse[expression.body.type](contract, expression.body);
for (let x = 0; x < expression.catchClauses.length; x++) {
parse[expression.catchClauses[x].body.type] &&
parse[expression.catchClauses[x].body.type](contract, expression.catchClauses[x].body);
}
};
parse.UsingStatement = function (contract, expression) { parse.UsingStatement = function (contract, expression) {
parse[expression.for.type] && parse[expression.for.type] &&
parse[expression.for.type](contract, expression.for); parse[expression.for.type](contract, expression.for);

@ -43,7 +43,7 @@ contract ContractA is ContractB {
errorCount++; errorCount++;
return (0, false); return (0, false);
} catch (bytes memory) { } catch (bytes memory) {
errorCount++; errorCount = errorCount + 1;
return (0, false); return (0, false);
} }
} }

@ -284,7 +284,7 @@ describe('Buidler Plugin: standard use cases', function() {
const expected = [ const expected = [
{ {
file: mock.pathToContract(buidlerConfig, 'ContractA.sol'), file: mock.pathToContract(buidlerConfig, 'ContractA.sol'),
pct: 87.5 pct: 61.54
}, },
{ {
file: mock.pathToContract(buidlerConfig, 'ContractB.sol'), file: mock.pathToContract(buidlerConfig, 'ContractB.sol'),

Loading…
Cancel
Save