Skip to content

Commit f18389d

Browse files
authored
Merge pull request #350 from sc-forks/fix/amxx-seita
Update solidity-parser-antlr to ^0.4.7 (type keyword)
2 parents 21db709 + 004142f commit f18389d

File tree

4 files changed

+1345
-37
lines changed

4 files changed

+1345
-37
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"req-cwd": "^1.0.1",
2828
"shelljs": "^0.8.3",
2929
"sol-explore": "^1.6.2",
30-
"solidity-parser-antlr": "0.4.5",
30+
"solidity-parser-antlr": "^0.4.7",
3131
"tree-kill": "^1.2.0",
3232
"web3": "1.0.0-beta.50",
3333
"web3-eth-abi": "1.0.0-beta.50"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
pragma solidity >0.4.99 <0.6.0;
2+
3+
contract Account {
4+
address public owner;
5+
6+
constructor(address payable _owner) public {
7+
owner = _owner;
8+
}
9+
10+
function setOwner(address _owner) public {
11+
require(msg.sender == owner);
12+
owner = _owner;
13+
}
14+
15+
function destroy(address payable recipient) public {
16+
require(msg.sender == owner);
17+
selfdestruct(recipient);
18+
}
19+
20+
function() payable external {}
21+
}
22+
23+
contract Factory {
24+
25+
bytes32 private contractCodeHash;
26+
27+
constructor() public {
28+
contractCodeHash = keccak256(
29+
type(Account).creationCode
30+
);
31+
}
32+
}

test/statements.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ describe('generic statements', () => {
2424
util.report(output.errors);
2525
})
2626

27+
it('should compile when using the type keyword', () => {
28+
const contract = util.getCode('statements/type-keyword.sol');
29+
const info = getInstrumentedVersion(contract, filePath);
30+
const output = JSON.parse(solc.compile(util.codeToCompilerInput(info.contract)));
31+
util.report(output.errors);
32+
})
33+
2734
it('should compile after instrumenting a single statement (first line of function)', () => {
2835
const contract = util.getCode('statements/single.sol');
2936
const info = getInstrumentedVersion(contract, filePath);

0 commit comments

Comments
 (0)