Skip to content

Commit 9848165

Browse files
maxsam4mattiaerre
authored andcommitted
Fixed payable array (#111)
* Fixed payable array * Linting
1 parent 04d5859 commit 9848165

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/printer.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,22 @@ function genericPrint(path, options, print) {
387387
].filter(element => element)
388388
);
389389
}
390-
case 'ArrayTypeName':
390+
case 'ArrayTypeName': {
391+
let stateMutability = '';
392+
if (
393+
node.baseTypeName.name === 'address' &&
394+
node.baseTypeName.stateMutability
395+
) {
396+
stateMutability = concat([' ', node.baseTypeName.stateMutability]);
397+
}
391398
return concat([
392399
path.call(print, 'baseTypeName'),
400+
stateMutability,
393401
'[',
394402
node.length ? path.call(print, 'length') : '',
395403
']'
396404
]);
405+
}
397406
case 'Conditional':
398407
return join(' ', [
399408
path.call(print, 'condition'),

tests/AddressPayable/AddressPayable.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
pragma solidity ^0.5.2;
22

33
contract AddressPayable {
4-
function sendSomeEth(address payable to) public payable {
4+
address payable[] hello;
5+
function sendSomeEth(address payable to, address payable[] memory world) public payable {
56
address payable target = to;
67
target.transfer(msg.value);
78
}

tests/AddressPayable/__snapshots__/jsfmt.spec.js.snap

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ exports[`AddressPayable.sol 1`] = `
44
pragma solidity ^0.5.2;
55
66
contract AddressPayable {
7-
function sendSomeEth(address payable to) public payable {
7+
address payable[] hello;
8+
function sendSomeEth(address payable to, address payable[] memory world) public payable {
89
address payable target = to;
910
target.transfer(msg.value);
1011
}
@@ -13,7 +14,11 @@ contract AddressPayable {
1314
pragma solidity ^0.5.2;
1415
1516
contract AddressPayable {
16-
function sendSomeEth(address payable to) public payable {
17+
address payable[] hello;
18+
function sendSomeEth(address payable to, address payable[] memory world)
19+
public
20+
payable
21+
{
1722
address payable target = to;
1823
target.transfer(msg.value);
1924
}

0 commit comments

Comments
 (0)