Skip to content

Commit be2d118

Browse files
authored
Merge pull request #5 from maxsam4/dev
Dev
2 parents 4ef8b22 + ba2fd9d commit be2d118

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
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.6",
3+
"version": "1.0.0-alpha.10",
44
"description": "prettier plugin for solidity that refactors solidity 0.4.x code to solidity 0.5.x code",
55
"main": "src",
66
"repository": {

src/printer.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,22 @@ function genericPrint(path, options, print) {
139139
);
140140
case 'Parameter':
141141
doc = path.call(print, 'typeName');
142-
if (!node.storageLocation && node.typeName.type !== 'ElementaryTypeName') {
142+
if (!node.storageLocation &&
143+
node.typeName.type !== 'UserDefinedTypeName' &&
144+
(node.typeName.type !== 'ElementaryTypeName' || node.typeName.name === 'string' || node.typeName.name === 'bytes')
145+
) {
143146
let parentNode = path.getParentNode();
144147
let parentParentNode = path.getParentNode(1);
145-
if (parentParentNode.parameters === parentNode) {
146-
if(parentParentNode.visibility === 'external') {
147-
doc = join(
148-
' ',
149-
[doc, 'calldata', node.name].filter(element => element)
150-
);
151-
} else {
152-
doc = join(
153-
' ',
154-
[doc, 'memory', node.name].filter(element => element)
155-
);
156-
}
148+
if (parentParentNode.parameters === parentNode && parentParentNode.visibility === 'external') {
149+
doc = join(
150+
' ',
151+
[doc, 'calldata', node.name].filter(element => element)
152+
);
153+
} else {
154+
doc = join(
155+
' ',
156+
[doc, 'memory', node.name].filter(element => element)
157+
);
157158
}
158159
} else {
159160
doc = join(

0 commit comments

Comments
 (0)