Skip to content

Commit f3dba53

Browse files
authored
Merge pull request #7 from maxsam4/dev
Dev
2 parents ad5986a + ed01e7c commit f3dba53

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ You may add the command script to your package.json file and then use `npm run s
4444
4) Low level `call` now returns 2 parameters rather than 1. This plugin does not rafactor it.
4545

4646
### Known bugs
47-
1) Incomplete tupples like `(hello, )` get incorrectly refactored to `(hello)`.
47+
None. Please report the bugs you may find.
4848

4949
### TODO
5050
1) Add test cases.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "prettier-plugin-solidity-refactor",
3-
"version": "1.0.0-alpha.12",
3+
"version": "1.0.0-alpha.13",
44
"description": "prettier plugin for solidity that refactors solidity 0.4.x code to solidity 0.5.x code",
55
"main": "src",
66
"repository": {
@@ -30,7 +30,7 @@
3030
"escape-string-regexp": "^1.0.5",
3131
"extract-comments": "^1.1.0",
3232
"prettier": "^1.15.3",
33-
"solidity-parser-antlr": "^0.3.3",
33+
"solidity-parser-antlr": "^0.4.0",
3434
"string-width": "^3.0.0"
3535
}
3636
}

src/printer.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ function printPreservingEmptyLines(path, key, options, print) {
3131
function genericPrint(path, options, print) {
3232
const node = path.getValue();
3333
let doc;
34+
if (node === null) {
35+
return '';
36+
}
37+
3438
switch (node.type) {
3539
case 'SourceUnit':
3640
return concat([
@@ -338,12 +342,7 @@ function genericPrint(path, options, print) {
338342

339343
doc = join(
340344
', ',
341-
path.map(statementPath => {
342-
if (!statementPath.getValue()) {
343-
return ', ';
344-
}
345-
return print(statementPath);
346-
}, 'variables')
345+
path.map(statementPath => print(statementPath), 'variables')
347346
);
348347

349348
if (node.variables.length > 1 || startsWithVar) {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ prettier@^1.15.3:
5757
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.3.tgz#1feaac5bdd181237b54dbe65d874e02a1472786a"
5858
integrity sha512-gAU9AGAPMaKb3NNSUUuhhFAS7SCO4ALTN4nRIn6PJ075Qd28Yn2Ig2ahEJWdJwJmlEBTUfC7mMUSFy8MwsOCfg==
5959

60-
solidity-parser-antlr@^0.3.3:
61-
version "0.3.3"
62-
resolved "https://registry.yarnpkg.com/solidity-parser-antlr/-/solidity-parser-antlr-0.3.3.tgz#0352e35f914095daa7eef9f3a55cf8074e28cc5b"
63-
integrity sha512-RNUc18pjf7DLWs//WF+V+VnvrbetEbNFUYxm2JFbXU62G9WSu+nVyDxV5r+FG4wu8jom17vLdM/3I7bMBGfZ9g==
60+
solidity-parser-antlr@^0.4.0:
61+
version "0.4.0"
62+
resolved "https://registry.yarnpkg.com/solidity-parser-antlr/-/solidity-parser-antlr-0.4.0.tgz#005f38c396ca23cf7aada9b1a10d875176788201"
63+
integrity sha512-RrIsh5VoHmrMQia6yLY8u8rx3JPREhSiCFz4Xb0h1Oh0prUYU2ukyWO8gG892V0UMHIXCWqvdZ3wSctNwdWThg==
6464

6565
string-width@^3.0.0:
6666
version "3.0.0"

0 commit comments

Comments
 (0)