File tree Expand file tree Collapse file tree 3 files changed +32
-11
lines changed Expand file tree Collapse file tree 3 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -7,17 +7,23 @@ const {
77const { printSeparatedList } = require ( '../common/printer-helpers' ) ;
88
99const StructDefinition = {
10- print : ( { node, path, print } ) => [
11- 'struct ' ,
12- node . name ,
13- ' {' ,
14- printSeparatedList ( path . map ( print , 'members' ) , {
15- firstSeparator : hardline ,
16- separator : [ ';' , hardline ] ,
17- lastSeparator : [ ';' , hardline ]
18- } ) ,
19- '}'
20- ]
10+ print : ( { node, path, print } ) => {
11+ const parts = [ 'struct ' , node . name , ' {' ] ;
12+
13+ if ( node . members . length > 0 ) {
14+ parts . push (
15+ printSeparatedList ( path . map ( print , 'members' ) , {
16+ firstSeparator : hardline ,
17+ separator : [ ';' , hardline ] ,
18+ lastSeparator : [ ';' , hardline ]
19+ } )
20+ ) ;
21+ }
22+
23+ parts . push ( '}' ) ;
24+
25+ return parts ;
26+ }
2127} ;
2228
2329module . exports = StructDefinition ;
Original file line number Diff line number Diff line change 1+ struct EmptyStruct {}
Original file line number Diff line number Diff line change @@ -170,3 +170,17 @@ contract Issue564 {
170170
171171================================================================================
172172` ;
173+
174+ exports [` Issue799.sol format 1` ] = `
175+ ====================================options=====================================
176+ parsers: ["solidity-parse"]
177+ printWidth: 80
178+ | printWidth
179+ =====================================input======================================
180+ struct EmptyStruct { }
181+
182+ =====================================output=====================================
183+ struct EmptyStruct { }
184+
185+ ================================================================================
186+ ` ;
You can’t perform that action at this time.
0 commit comments