Skip to content

Commit 95341a0

Browse files
authored
Add support for UncheckedStatement blocks (#712)
1 parent ede386e commit 95341a0

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

lib/parse.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ parse.TryStatement = function(contract, expression) {
239239
}
240240
};
241241

242+
parse.UncheckedStatement = function(contract, expression) {
243+
parse[expression.block.type] &&
244+
parse[expression.block.type](contract, expression.block);
245+
}
246+
242247
parse.UsingStatement = function (contract, expression) {
243248
parse[expression.for.type] &&
244249
parse[expression.for.type](contract, expression.for);

test/integration/projects/solc-8/contracts/Contract_solc8.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@ contract ContractA {
1717

1818
someAddress = _add;
1919
}
20+
21+
function checkSomething() external {
22+
uint a = 5;
23+
24+
unchecked {
25+
a++;
26+
}
27+
28+
unchecked {}
29+
}
2030
}

test/integration/projects/solc-8/test/test_solc8.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ contract("contracta", function(accounts) {
1010
it('a:throwError', async function(){
1111
await a.throwError(a.address);
1212
});
13+
14+
it('a:checkSomething', async function(){
15+
await a.checkSomething();
16+
})
1317
});

test/units/hardhat/standard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ describe('Hardhat Plugin: standard use cases', function() {
335335
const expectedLine = [
336336
{
337337
file: mock.pathToContract(hardhatConfig, 'Contract_solc8.sol'),
338-
pct: 75
338+
pct: 87.5
339339
},
340340
];
341341

0 commit comments

Comments
 (0)