Skip to content

Commit df8721d

Browse files
Franco Victoriomattiaerre
authored andcommitted
Add space after returns keyword (#88)
1 parent 433e6f6 commit df8721d

File tree

9 files changed

+56
-50
lines changed

9 files changed

+56
-50
lines changed

src/printer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function genericPrint(path, options, print) {
112112
if (node.returnParameters) {
113113
doc = join(' ', [
114114
doc,
115-
concat(['returns(', path.call(print, 'returnParameters'), ')'])
115+
concat(['returns (', path.call(print, 'returnParameters'), ')'])
116116
]);
117117
}
118118
if (node.body) {
@@ -519,7 +519,7 @@ function genericPrint(path, options, print) {
519519
const returns = returnTypes => {
520520
if (returnTypes.length > 0) {
521521
return concat([
522-
'returns(',
522+
'returns (',
523523
join(', ', path.map(print, 'returnTypes')),
524524
')'
525525
]);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ contract BasicIterator {
6363
}
6464
}
6565
66-
function getSum() constant returns(uint) { // "constant" just means this function returns something to the caller
66+
function getSum() constant returns (uint) { // "constant" just means this function returns something to the caller
6767
// which is immediately followed by what type gets returned, in this case a full uint256
6868
uint8 sum = 0;
6969
uint8 x = 0;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pragma solidity ^0.4.24;
5454
5555
contract Contract {
5656
struct StructWithFunctionTypes {
57-
function(uint, uint) returns(bool) a;
57+
function(uint, uint) returns (bool) a;
5858
function(bytes32, bytes32) internal view[] b;
5959
function(bytes32, bytes32) internal[] c;
6060
}
@@ -69,7 +69,7 @@ contract Contract {
6969
_;
7070
}
7171
72-
function ifBlockInOneLine(uint a) returns(uint b) {
72+
function ifBlockInOneLine(uint a) returns (uint b) {
7373
if (a < 0) b = 0x67;
7474
else if (a == 0) b = 0x12;
7575
else b = 0x78;
@@ -81,7 +81,7 @@ contract Contract {
8181
for (i = 0; i < 10; i++) sum += i;
8282
}
8383
84-
function fun(uint256 a) returns(uint) {
84+
function fun(uint256 a) returns (uint) {
8585
if (something) foo();
8686
// comment
8787
else if (somethingElse) bar();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ contract IndexOf {
7878
7979
int whatwastheval = -10; // -2 = not yet tested, as separate from -1, tested but error
8080
81-
function indexOf(string _a, string _b) returns(int) { // _a = string to search, _b = string we want to find
81+
function indexOf(string _a, string _b) returns (int) { // _a = string to search, _b = string we want to find
8282
bytes memory a = bytes(_a);
8383
bytes memory b = bytes(_b);
8484
@@ -109,7 +109,7 @@ contract IndexOf {
109109
}
110110
}
111111
112-
function whatWasTheVal() constant returns(int) {
112+
function whatWasTheVal() constant returns (int) {
113113
return whatwastheval;
114114
}
115115

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ contract Ownable {
104104
/**
105105
* @return the address of the owner.
106106
*/
107-
function owner() public view returns(address) {
107+
function owner() public view returns (address) {
108108
return _owner;
109109
}
110110
@@ -119,7 +119,7 @@ contract Ownable {
119119
/**
120120
* @return true if \`msg.sender\` is the owner of the contract.
121121
*/
122-
function isOwner() public view returns(bool) {
122+
function isOwner() public view returns (bool) {
123123
return msg.sender == _owner;
124124
}
125125

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale {
9494
require(_goal <= _cap);
9595
}
9696
97-
function createTokenContract() internal returns(MintableToken) {
97+
function createTokenContract() internal returns (MintableToken) {
9898
return new SampleCrowdsaleToken();
9999
}
100100

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ contract SimpleAuction {
194194
}
195195
196196
/// Withdraw a bid that was overbid.
197-
function withdraw() public returns(bool) {
197+
function withdraw() public returns (bool) {
198198
uint amount = pendingReturns[msg.sender];
199199
if (amount > 0) {
200200
// It is important to set this to zero because the recipient

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ contract SimpleStorage {
2626
storedData = x;
2727
}
2828
29-
function get() public view returns(uint) {
29+
function get() public view returns (uint) {
3030
return storedData;
3131
}
3232
}

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

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ library strings {
787787
* @param self The string to make a slice from.
788788
* @return A newly allocated slice containing the entire string.
789789
*/
790-
function toSlice(string memory self) internal pure returns(slice memory) {
790+
function toSlice(string memory self) internal pure returns (slice memory) {
791791
uint ptr;
792792
assembly {
793793
ptr := add(self, 0x20)
@@ -800,7 +800,7 @@ library strings {
800800
* @param self The value to find the length of.
801801
* @return The length of the string, from 0 to 32.
802802
*/
803-
function len(bytes32 self) internal pure returns(uint) {
803+
function len(bytes32 self) internal pure returns (uint) {
804804
uint ret;
805805
if (self == 0) return 0;
806806
if (self & 0xffffffffffffffffffffffffffffffff == 0) {
@@ -832,7 +832,7 @@ library strings {
832832
* @return A new slice containing the value of the input argument up to the
833833
* first null.
834834
*/
835-
function toSliceB32(bytes32 self) internal pure returns(slice memory ret) {
835+
function toSliceB32(bytes32 self) internal pure returns (slice memory ret) {
836836
// Allocate space for \`self\` in memory, copy it there, and point ret at it
837837
assembly {
838838
let ptr := mload(0x40)
@@ -848,7 +848,7 @@ library strings {
848848
* @param self The slice to copy.
849849
* @return A new slice containing the same data as \`self\`.
850850
*/
851-
function copy(slice memory self) internal pure returns(slice memory) {
851+
function copy(slice memory self) internal pure returns (slice memory) {
852852
return slice(self._len, self._ptr);
853853
}
854854
@@ -857,7 +857,7 @@ library strings {
857857
* @param self The slice to copy.
858858
* @return A newly allocated string containing the slice's text.
859859
*/
860-
function toString(slice memory self) internal pure returns(string memory) {
860+
function toString(slice memory self) internal pure returns (string memory) {
861861
string memory ret = new string(self._len);
862862
uint retptr;
863863
assembly {
@@ -876,7 +876,7 @@ library strings {
876876
* @param self The slice to operate on.
877877
* @return The length of the slice in runes.
878878
*/
879-
function len(slice memory self) internal pure returns(uint l) {
879+
function len(slice memory self) internal pure returns (uint l) {
880880
// Starting at ptr-31 means the LSB will be the byte we care about
881881
uint ptr = self._ptr - 31;
882882
uint end = ptr + self._len;
@@ -906,7 +906,7 @@ library strings {
906906
* @param self The slice to operate on.
907907
* @return True if the slice is empty, False otherwise.
908908
*/
909-
function empty(slice memory self) internal pure returns(bool) {
909+
function empty(slice memory self) internal pure returns (bool) {
910910
return self._len == 0;
911911
}
912912
@@ -919,9 +919,10 @@ library strings {
919919
* @param other The second slice to compare.
920920
* @return The result of the comparison.
921921
*/
922-
function compare(slice memory self, slice memory other) internal pure returns(
923-
int
924-
) {
922+
function compare(
923+
slice memory self,
924+
slice memory other
925+
) internal pure returns (int) {
925926
uint shortest = self._len;
926927
if (other._len < self._len) shortest = other._len;
927928
@@ -955,7 +956,7 @@ library strings {
955956
* @param self The second slice to compare.
956957
* @return True if the slices are equal, false otherwise.
957958
*/
958-
function equals(slice memory self, slice memory other) internal pure returns(
959+
function equals(slice memory self, slice memory other) internal pure returns (
959960
bool
960961
) {
961962
return compare(self, other) == 0;
@@ -968,9 +969,10 @@ library strings {
968969
* @param rune The slice that will contain the first rune.
969970
* @return \`rune\`.
970971
*/
971-
function nextRune(slice memory self, slice memory rune) internal pure returns(
972-
slice memory
973-
) {
972+
function nextRune(
973+
slice memory self,
974+
slice memory rune
975+
) internal pure returns (slice memory) {
974976
rune._ptr = self._ptr;
975977
976978
if (self._len == 0) {
@@ -1014,7 +1016,9 @@ library strings {
10141016
* @param self The slice to operate on.
10151017
* @return A slice containing only the first rune from \`self\`.
10161018
*/
1017-
function nextRune(slice memory self) internal pure returns(slice memory ret) {
1019+
function nextRune(slice memory self) internal pure returns (
1020+
slice memory ret
1021+
) {
10181022
nextRune(self, ret);
10191023
}
10201024
@@ -1023,7 +1027,7 @@ library strings {
10231027
* @param self The slice to operate on.
10241028
* @return The number of the first codepoint in the slice.
10251029
*/
1026-
function ord(slice memory self) internal pure returns(uint ret) {
1030+
function ord(slice memory self) internal pure returns (uint ret) {
10271031
if (self._len == 0) {
10281032
return 0;
10291033
}
@@ -1074,7 +1078,7 @@ library strings {
10741078
* @param self The slice to hash.
10751079
* @return The hash of the slice.
10761080
*/
1077-
function keccak(slice memory self) internal pure returns(bytes32 ret) {
1081+
function keccak(slice memory self) internal pure returns (bytes32 ret) {
10781082
assembly {
10791083
ret := keccak256(mload(add(self, 32)), mload(self))
10801084
}
@@ -1089,7 +1093,7 @@ library strings {
10891093
function startsWith(
10901094
slice memory self,
10911095
slice memory needle
1092-
) internal pure returns(bool) {
1096+
) internal pure returns (bool) {
10931097
if (self._len < needle._len) {
10941098
return false;
10951099
}
@@ -1115,9 +1119,10 @@ library strings {
11151119
* @param needle The slice to search for.
11161120
* @return \`self\`
11171121
*/
1118-
function beyond(slice memory self, slice memory needle) internal pure returns(
1119-
slice memory
1120-
) {
1122+
function beyond(
1123+
slice memory self,
1124+
slice memory needle
1125+
) internal pure returns (slice memory) {
11211126
if (self._len < needle._len) {
11221127
return self;
11231128
}
@@ -1149,7 +1154,7 @@ library strings {
11491154
function endsWith(
11501155
slice memory self,
11511156
slice memory needle
1152-
) internal pure returns(bool) {
1157+
) internal pure returns (bool) {
11531158
if (self._len < needle._len) {
11541159
return false;
11551160
}
@@ -1177,7 +1182,7 @@ library strings {
11771182
* @param needle The slice to search for.
11781183
* @return \`self\`
11791184
*/
1180-
function until(slice memory self, slice memory needle) internal pure returns(
1185+
function until(slice memory self, slice memory needle) internal pure returns (
11811186
slice memory
11821187
) {
11831188
if (self._len < needle._len) {
@@ -1208,7 +1213,7 @@ library strings {
12081213
uint selfptr,
12091214
uint needlelen,
12101215
uint needleptr
1211-
) private pure returns(uint) {
1216+
) private pure returns (uint) {
12121217
uint ptr = selfptr;
12131218
uint idx;
12141219
@@ -1262,7 +1267,7 @@ library strings {
12621267
uint selfptr,
12631268
uint needlelen,
12641269
uint needleptr
1265-
) private pure returns(uint) {
1270+
) private pure returns (uint) {
12661271
uint ptr;
12671272
12681273
if (needlelen <= selflen) {
@@ -1316,7 +1321,7 @@ library strings {
13161321
* @param needle The text to search for.
13171322
* @return \`self\`.
13181323
*/
1319-
function find(slice memory self, slice memory needle) internal pure returns(
1324+
function find(slice memory self, slice memory needle) internal pure returns (
13201325
slice memory
13211326
) {
13221327
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
@@ -1333,7 +1338,7 @@ library strings {
13331338
* @param needle The text to search for.
13341339
* @return \`self\`.
13351340
*/
1336-
function rfind(slice memory self, slice memory needle) internal pure returns(
1341+
function rfind(slice memory self, slice memory needle) internal pure returns (
13371342
slice memory
13381343
) {
13391344
uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
@@ -1355,7 +1360,7 @@ library strings {
13551360
slice memory self,
13561361
slice memory needle,
13571362
slice memory token
1358-
) internal pure returns(slice memory) {
1363+
) internal pure returns (slice memory) {
13591364
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
13601365
token._ptr = self._ptr;
13611366
token._len = ptr - self._ptr;
@@ -1378,7 +1383,7 @@ library strings {
13781383
* @param needle The text to search for in \`self\`.
13791384
* @return The part of \`self\` up to the first occurrence of \`delim\`.
13801385
*/
1381-
function split(slice memory self, slice memory needle) internal pure returns(
1386+
function split(slice memory self, slice memory needle) internal pure returns (
13821387
slice memory token
13831388
) {
13841389
split(self, needle, token);
@@ -1398,7 +1403,7 @@ library strings {
13981403
slice memory self,
13991404
slice memory needle,
14001405
slice memory token
1401-
) internal pure returns(slice memory) {
1406+
) internal pure returns (slice memory) {
14021407
uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
14031408
token._ptr = ptr;
14041409
token._len = self._len - (ptr - self._ptr);
@@ -1420,9 +1425,10 @@ library strings {
14201425
* @param needle The text to search for in \`self\`.
14211426
* @return The part of \`self\` after the last occurrence of \`delim\`.
14221427
*/
1423-
function rsplit(slice memory self, slice memory needle) internal pure returns(
1424-
slice memory token
1425-
) {
1428+
function rsplit(
1429+
slice memory self,
1430+
slice memory needle
1431+
) internal pure returns (slice memory token) {
14261432
rsplit(self, needle, token);
14271433
}
14281434
@@ -1432,7 +1438,7 @@ library strings {
14321438
* @param needle The text to search for in \`self\`.
14331439
* @return The number of occurrences of \`needle\` found in \`self\`.
14341440
*/
1435-
function count(slice memory self, slice memory needle) internal pure returns(
1441+
function count(slice memory self, slice memory needle) internal pure returns (
14361442
uint cnt
14371443
) {
14381444
uint ptr = findPtr(
@@ -1461,7 +1467,7 @@ library strings {
14611467
function contains(
14621468
slice memory self,
14631469
slice memory needle
1464-
) internal pure returns(bool) {
1470+
) internal pure returns (bool) {
14651471
return rfindPtr(
14661472
self._len,
14671473
self._ptr,
@@ -1477,7 +1483,7 @@ library strings {
14771483
* @param other The second slice to concatenate.
14781484
* @return The concatenation of the two strings.
14791485
*/
1480-
function concat(slice memory self, slice memory other) internal pure returns(
1486+
function concat(slice memory self, slice memory other) internal pure returns (
14811487
string memory
14821488
) {
14831489
string memory ret = new string(self._len + other._len);
@@ -1498,7 +1504,7 @@ library strings {
14981504
* @return A newly allocated string containing all the slices in \`parts\`,
14991505
* joined with \`self\`.
15001506
*/
1501-
function join(slice memory self, slice[] memory parts) internal pure returns(
1507+
function join(slice memory self, slice[] memory parts) internal pure returns (
15021508
string memory
15031509
) {
15041510
if (parts.length == 0) return "";

0 commit comments

Comments
 (0)