prettier-plugin-solidity
Advanced tools
Comparing version 1.0.0-alpha.6 to 1.0.0-alpha.7
{ | ||
"name": "prettier-plugin-solidity", | ||
"version": "1.0.0-alpha.6", | ||
"version": "1.0.0-alpha.7", | ||
"description": "prettier plugin for solidity", | ||
@@ -5,0 +5,0 @@ "main": "src", |
@@ -136,5 +136,6 @@ /* eslint-disable no-nested-ternary, operator-linebreak */ | ||
doc = path.call(print, 'typeName'); | ||
if (node.name) { | ||
doc = join(' ', [doc, node.name]); | ||
} | ||
doc = join( | ||
' ', | ||
[doc, node.storageLocation, node.name].filter(element => element) | ||
); | ||
return doc; | ||
@@ -221,3 +222,3 @@ case 'ModifierInvocation': | ||
node.initExpression ? path.call(print, 'initExpression') : '', | ||
' ', | ||
'; ', | ||
node.conditionExpression ? path.call(print, 'conditionExpression') : '', | ||
@@ -231,3 +232,3 @@ '; ', | ||
return concat(['emit ', path.call(print, 'eventCall'), ';']); | ||
case 'VariableDeclarationStatement': | ||
case 'VariableDeclarationStatement': { | ||
doc = join( | ||
@@ -250,3 +251,5 @@ ', ', | ||
} | ||
return concat([doc, ';']); | ||
const addSemicolon = path.getParentNode().type !== 'ForStatement'; | ||
return concat([doc, addSemicolon ? ';' : '']); | ||
} | ||
case 'StateVariableDeclaration': | ||
@@ -438,4 +441,5 @@ doc = concat( | ||
'{', | ||
indent(hardline), | ||
indent(join(line, path.map(print, 'operations'))), | ||
hardline, | ||
join(line, path.map(print, 'operations')), | ||
'}' | ||
@@ -446,2 +450,5 @@ ]); | ||
case 'AssemblyCall': | ||
if (node.arguments.length === 0) { | ||
return node.functionName; | ||
} | ||
// @TODO: add call args | ||
@@ -468,5 +475,15 @@ return concat([ | ||
return join(' ', [doc, '{}']); | ||
case 'AssemblyFunctionDefinition': | ||
// @TODO | ||
return ''; | ||
case 'AssemblyLocalDefinition': | ||
return join(' ', [ | ||
'let', | ||
join(', ', path.map(print, 'names')), | ||
':=', | ||
path.call(print, 'expression') | ||
]); | ||
case 'AssemblyAssignment': | ||
return join(' ', [ | ||
join(', ', path.map(print, 'names')), | ||
':=', | ||
path.call(print, 'expression') | ||
]); | ||
default: | ||
@@ -473,0 +490,0 @@ throw new Error(`Unknown type: ${JSON.stringify(node.type)}`); |
140149
45
694