~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// AstFormattingVisitor_TypeMembers.cs
 
3
//
 
4
// Author:
 
5
//       Mike KrĆ¼ger <mkrueger@xamarin.com>
 
6
//
 
7
// Copyright (c) 2013 Xamarin Inc. (http://xamarin.com)
 
8
//
 
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
10
// of this software and associated documentation files (the "Software"), to deal
 
11
// in the Software without restriction, including without limitation the rights
 
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
13
// copies of the Software, and to permit persons to whom the Software is
 
14
// furnished to do so, subject to the following conditions:
 
15
//
 
16
// The above copyright notice and this permission notice shall be included in
 
17
// all copies or substantial portions of the Software.
 
18
//
 
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 
25
// THE SOFTWARE.
 
26
using System;
 
27
using System.Linq;
 
28
 
 
29
namespace ICSharpCode.NRefactory.CSharp
 
30
{
 
31
        partial class FormattingVisitor : DepthFirstAstVisitor
 
32
        {
 
33
                public override void VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration)
 
34
                {
 
35
                        FixAttributes(propertyDeclaration);
 
36
                        bool oneLine = false;
 
37
                        bool fixClosingBrace = false;
 
38
                        switch (policy.PropertyFormatting) {
 
39
                                case PropertyFormatting.AllowOneLine:
 
40
                                        bool isSimple = IsSimpleAccessor(propertyDeclaration.Getter) && IsSimpleAccessor(propertyDeclaration.Setter);
 
41
                                        int accessorLine = propertyDeclaration.RBraceToken.StartLocation.Line;
 
42
                                        if (!propertyDeclaration.Getter.IsNull && propertyDeclaration.Setter.IsNull) {
 
43
                                                accessorLine = propertyDeclaration.Getter.StartLocation.Line;
 
44
                                        } else if (propertyDeclaration.Getter.IsNull && !propertyDeclaration.Setter.IsNull) {
 
45
                                                accessorLine = propertyDeclaration.Setter.StartLocation.Line;
 
46
                                        } else {
 
47
                                                var acc = propertyDeclaration.Getter.StartLocation < propertyDeclaration.Setter.StartLocation ?
 
48
                                                        propertyDeclaration.Getter : propertyDeclaration.Setter;
 
49
                                                accessorLine = acc.StartLocation.Line;
 
50
                                        }
 
51
                                        if (!isSimple || propertyDeclaration.LBraceToken.StartLocation.Line != accessorLine) {
 
52
                                                fixClosingBrace = true;
 
53
                                                FixOpenBrace(policy.PropertyBraceStyle, propertyDeclaration.LBraceToken);
 
54
                                        } else {
 
55
                                                ForceSpacesBefore(propertyDeclaration.Getter, true);
 
56
                                                ForceSpacesBefore(propertyDeclaration.Setter, true);
 
57
                                                ForceSpacesBeforeRemoveNewLines(propertyDeclaration.RBraceToken, true);
 
58
                                                oneLine = true;
 
59
                                        }
 
60
                                        break;
 
61
                                        case PropertyFormatting.ForceNewLine:
 
62
                                                fixClosingBrace = true;
 
63
                                                FixOpenBrace(policy.PropertyBraceStyle, propertyDeclaration.LBraceToken);
 
64
                                                break;
 
65
                                        case PropertyFormatting.ForceOneLine:
 
66
                                                isSimple = IsSimpleAccessor(propertyDeclaration.Getter) && IsSimpleAccessor(propertyDeclaration.Setter);
 
67
                                                if (isSimple) {
 
68
                                                        int offset = this.document.GetOffset(propertyDeclaration.LBraceToken.StartLocation);
 
69
 
 
70
                                                        int start = SearchWhitespaceStart(offset);
 
71
                                                        int end = SearchWhitespaceEnd(offset);
 
72
                                                        AddChange(start, offset - start, " ");
 
73
                                                        AddChange(offset + 1, end - offset - 2, " ");
 
74
 
 
75
                                                        offset = this.document.GetOffset(propertyDeclaration.RBraceToken.StartLocation);
 
76
                                                        start = SearchWhitespaceStart(offset);
 
77
                                                        AddChange(start, offset - start, " ");
 
78
                                                        oneLine = true;
 
79
 
 
80
                                                } else {
 
81
                                                        fixClosingBrace = true;
 
82
                                                        FixOpenBrace(policy.PropertyBraceStyle, propertyDeclaration.LBraceToken);
 
83
                                                }
 
84
                                        break;
 
85
                        }
 
86
                        if (policy.IndentPropertyBody)
 
87
                                curIndent.Push(IndentType.Block);
 
88
 
 
89
                        ///System.Console.WriteLine ("one line: " + oneLine);
 
90
                        if (!propertyDeclaration.Getter.IsNull) {
 
91
                                if (!oneLine) {
 
92
                                        if (!IsLineIsEmptyUpToEol(propertyDeclaration.Getter.StartLocation)) {
 
93
                                                int offset = this.document.GetOffset(propertyDeclaration.Getter.StartLocation);
 
94
                                                int start = SearchWhitespaceStart(offset);
 
95
                                                string indentString = this.curIndent.IndentString;
 
96
                                                AddChange(start, offset - start, this.options.EolMarker + indentString);
 
97
                                        } else {
 
98
                                                FixIndentation(propertyDeclaration.Getter);
 
99
                                        }
 
100
                                } else {
 
101
                                        int offset = this.document.GetOffset(propertyDeclaration.Getter.StartLocation);
 
102
                                        int start = SearchWhitespaceStart(offset);
 
103
                                        AddChange(start, offset - start, " ");
 
104
 
 
105
                                        ForceSpacesBefore(propertyDeclaration.Getter.Body.LBraceToken, true);
 
106
                                        ForceSpacesBefore(propertyDeclaration.Getter.Body.RBraceToken, true);
 
107
                                }
 
108
                                if (!propertyDeclaration.Getter.Body.IsNull) {
 
109
                                        if (!policy.AllowPropertyGetBlockInline || propertyDeclaration.Getter.Body.LBraceToken.StartLocation.Line != propertyDeclaration.Getter.Body.RBraceToken.StartLocation.Line) {
 
110
                                                FixOpenBrace(policy.PropertyGetBraceStyle, propertyDeclaration.Getter.Body.LBraceToken);
 
111
                                                VisitBlockWithoutFixingBraces(propertyDeclaration.Getter.Body, policy.IndentBlocks);
 
112
                                                FixClosingBrace(policy.PropertyGetBraceStyle, propertyDeclaration.Getter.Body.RBraceToken);
 
113
                                        } else {
 
114
                                                nextStatementIndent = " ";
 
115
                                                VisitBlockWithoutFixingBraces(propertyDeclaration.Getter.Body, policy.IndentBlocks);
 
116
 
 
117
                                        }
 
118
                                }
 
119
                        }
 
120
 
 
121
                        if (!propertyDeclaration.Setter.IsNull) {
 
122
                                if (!oneLine) {
 
123
                                        if (!IsLineIsEmptyUpToEol(propertyDeclaration.Setter.StartLocation)) {
 
124
                                                int offset = document.GetOffset(propertyDeclaration.Setter.StartLocation);
 
125
                                                int start = SearchWhitespaceStart(offset);
 
126
                                                string indentString = curIndent.IndentString;
 
127
                                                AddChange(start, offset - start, options.EolMarker + indentString);
 
128
                                        } else {
 
129
                                                FixIndentation(propertyDeclaration.Setter);
 
130
                                        }
 
131
                                } else {
 
132
                                        int offset = this.document.GetOffset(propertyDeclaration.Setter.StartLocation);
 
133
                                        int start = SearchWhitespaceStart(offset);
 
134
                                        AddChange(start, offset - start, " ");
 
135
 
 
136
                                        ForceSpacesBefore(propertyDeclaration.Setter.Body.LBraceToken, true);
 
137
                                        ForceSpacesBefore(propertyDeclaration.Setter.Body.RBraceToken, true);
 
138
                                }
 
139
                                if (!propertyDeclaration.Setter.Body.IsNull) {
 
140
                                        if (!policy.AllowPropertySetBlockInline || propertyDeclaration.Setter.Body.LBraceToken.StartLocation.Line != propertyDeclaration.Setter.Body.RBraceToken.StartLocation.Line) {
 
141
                                                FixOpenBrace(policy.PropertySetBraceStyle, propertyDeclaration.Setter.Body.LBraceToken);
 
142
                                                VisitBlockWithoutFixingBraces(propertyDeclaration.Setter.Body, policy.IndentBlocks);
 
143
                                                FixClosingBrace(policy.PropertySetBraceStyle, propertyDeclaration.Setter.Body.RBraceToken);
 
144
                                        } else {
 
145
                                                nextStatementIndent = " ";
 
146
                                                VisitBlockWithoutFixingBraces(propertyDeclaration.Setter.Body, policy.IndentBlocks);
 
147
                                        }
 
148
                                }
 
149
                        }
 
150
 
 
151
                        if (policy.IndentPropertyBody) {
 
152
                                curIndent.Pop ();
 
153
                        }
 
154
                        if (fixClosingBrace)
 
155
                                FixClosingBrace(policy.PropertyBraceStyle, propertyDeclaration.RBraceToken);
 
156
 
 
157
                }
 
158
 
 
159
                public override void VisitAccessor(Accessor accessor)
 
160
                {
 
161
                        FixAttributes(accessor);
 
162
 
 
163
                        base.VisitAccessor(accessor);
 
164
                }
 
165
 
 
166
 
 
167
                public override void VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration)
 
168
                {
 
169
                        FixAttributes(indexerDeclaration);
 
170
 
 
171
                        ForceSpacesBefore(indexerDeclaration.LBracketToken, policy.SpaceBeforeIndexerDeclarationBracket);
 
172
                        ForceSpacesAfter(indexerDeclaration.LBracketToken, policy.SpaceWithinIndexerDeclarationBracket);
 
173
 
 
174
                        FormatArguments(indexerDeclaration);
 
175
 
 
176
                        FixOpenBrace(policy.PropertyBraceStyle, indexerDeclaration.LBraceToken);
 
177
                        if (policy.IndentPropertyBody)
 
178
                                curIndent.Push(IndentType.Block);
 
179
 
 
180
                        if (!indexerDeclaration.Getter.IsNull) {
 
181
                                FixIndentation(indexerDeclaration.Getter);
 
182
                                if (!indexerDeclaration.Getter.Body.IsNull) {
 
183
                                        if (!policy.AllowPropertyGetBlockInline || indexerDeclaration.Getter.Body.LBraceToken.StartLocation.Line != indexerDeclaration.Getter.Body.RBraceToken.StartLocation.Line) {
 
184
                                                FixOpenBrace(policy.PropertyGetBraceStyle, indexerDeclaration.Getter.Body.LBraceToken);
 
185
                                                VisitBlockWithoutFixingBraces(indexerDeclaration.Getter.Body, policy.IndentBlocks);
 
186
                                                FixClosingBrace(policy.PropertyGetBraceStyle, indexerDeclaration.Getter.Body.RBraceToken);
 
187
                                        } else {
 
188
                                                nextStatementIndent = " ";
 
189
                                                VisitBlockWithoutFixingBraces(indexerDeclaration.Getter.Body, policy.IndentBlocks);
 
190
                                        }
 
191
                                }
 
192
                        }
 
193
 
 
194
                        if (!indexerDeclaration.Setter.IsNull) {
 
195
                                FixIndentation(indexerDeclaration.Setter);
 
196
                                if (!indexerDeclaration.Setter.Body.IsNull) {
 
197
                                        if (!policy.AllowPropertySetBlockInline || indexerDeclaration.Setter.Body.LBraceToken.StartLocation.Line != indexerDeclaration.Setter.Body.RBraceToken.StartLocation.Line) {
 
198
                                                FixOpenBrace(policy.PropertySetBraceStyle, indexerDeclaration.Setter.Body.LBraceToken);
 
199
                                                VisitBlockWithoutFixingBraces(indexerDeclaration.Setter.Body, policy.IndentBlocks);
 
200
                                                FixClosingBrace(policy.PropertySetBraceStyle, indexerDeclaration.Setter.Body.RBraceToken);
 
201
                                        } else {
 
202
                                                nextStatementIndent = " ";
 
203
                                                VisitBlockWithoutFixingBraces(indexerDeclaration.Setter.Body, policy.IndentBlocks);
 
204
                                        }
 
205
                                }
 
206
                        }
 
207
                        if (policy.IndentPropertyBody)
 
208
                                curIndent.Pop();
 
209
 
 
210
                        FixClosingBrace(policy.PropertyBraceStyle, indexerDeclaration.RBraceToken);
 
211
                }
 
212
 
 
213
                static bool IsSimpleEvent(AstNode node)
 
214
                {
 
215
                        return node is EventDeclaration;
 
216
                }
 
217
 
 
218
                public override void VisitCustomEventDeclaration(CustomEventDeclaration eventDeclaration)
 
219
                {
 
220
                        FixAttributes(eventDeclaration);
 
221
 
 
222
                        FixOpenBrace(policy.EventBraceStyle, eventDeclaration.LBraceToken);
 
223
                        if (policy.IndentEventBody)
 
224
                                curIndent.Push(IndentType.Block);
 
225
 
 
226
                        if (!eventDeclaration.AddAccessor.IsNull) {
 
227
                                FixIndentation(eventDeclaration.AddAccessor);
 
228
                                if (!eventDeclaration.AddAccessor.Body.IsNull) {
 
229
                                        if (!policy.AllowEventAddBlockInline || eventDeclaration.AddAccessor.Body.LBraceToken.StartLocation.Line != eventDeclaration.AddAccessor.Body.RBraceToken.StartLocation.Line) {
 
230
                                                FixOpenBrace(policy.EventAddBraceStyle, eventDeclaration.AddAccessor.Body.LBraceToken);
 
231
                                                VisitBlockWithoutFixingBraces(eventDeclaration.AddAccessor.Body, policy.IndentBlocks);
 
232
                                                FixClosingBrace(policy.EventAddBraceStyle, eventDeclaration.AddAccessor.Body.RBraceToken);
 
233
                                        } else {
 
234
                                                nextStatementIndent = " ";
 
235
                                                VisitBlockWithoutFixingBraces(eventDeclaration.AddAccessor.Body, policy.IndentBlocks);
 
236
                                        }
 
237
                                }
 
238
                        }
 
239
 
 
240
                        if (!eventDeclaration.RemoveAccessor.IsNull) {
 
241
                                FixIndentation(eventDeclaration.RemoveAccessor);
 
242
                                if (!eventDeclaration.RemoveAccessor.Body.IsNull) {
 
243
                                        if (!policy.AllowEventRemoveBlockInline || eventDeclaration.RemoveAccessor.Body.LBraceToken.StartLocation.Line != eventDeclaration.RemoveAccessor.Body.RBraceToken.StartLocation.Line) {
 
244
                                                FixOpenBrace(policy.EventRemoveBraceStyle, eventDeclaration.RemoveAccessor.Body.LBraceToken);
 
245
                                                VisitBlockWithoutFixingBraces(eventDeclaration.RemoveAccessor.Body, policy.IndentBlocks);
 
246
                                                FixClosingBrace(policy.EventRemoveBraceStyle, eventDeclaration.RemoveAccessor.Body.RBraceToken);
 
247
                                        } else {
 
248
                                                nextStatementIndent = " ";
 
249
                                                VisitBlockWithoutFixingBraces(eventDeclaration.RemoveAccessor.Body, policy.IndentBlocks);
 
250
                                        }
 
251
                                }
 
252
                        }
 
253
 
 
254
                        if (policy.IndentEventBody)
 
255
                                curIndent.Pop();
 
256
 
 
257
                        FixClosingBrace(policy.EventBraceStyle, eventDeclaration.RBraceToken);
 
258
                }
 
259
 
 
260
                public override void VisitEventDeclaration(EventDeclaration eventDeclaration)
 
261
                {
 
262
                        FixAttributes(eventDeclaration);
 
263
 
 
264
                        var lastLoc = eventDeclaration.StartLocation;
 
265
                        curIndent.Push(IndentType.Block);
 
266
                        foreach (var initializer in eventDeclaration.Variables) {
 
267
                                if (lastLoc.Line != initializer.StartLocation.Line) {
 
268
                                        FixStatementIndentation(initializer.StartLocation);
 
269
                                        lastLoc = initializer.StartLocation;
 
270
                                }
 
271
                                initializer.AcceptVisitor(this);
 
272
                        }
 
273
                        curIndent.Pop ();
 
274
                }
 
275
 
 
276
                
 
277
                public override void VisitFieldDeclaration(FieldDeclaration fieldDeclaration)
 
278
                {
 
279
                        FixAttributes(fieldDeclaration);
 
280
 
 
281
                        fieldDeclaration.ReturnType.AcceptVisitor(this);
 
282
                        ForceSpacesAfter(fieldDeclaration.ReturnType, true);
 
283
 
 
284
                        FormatCommas(fieldDeclaration, policy.SpaceBeforeFieldDeclarationComma, policy.SpaceAfterFieldDeclarationComma);
 
285
 
 
286
                        var lastLoc = fieldDeclaration.StartLocation;
 
287
                        foreach (var initializer in fieldDeclaration.Variables) {
 
288
                                if (lastLoc.Line != initializer.StartLocation.Line) {
 
289
                                        curIndent.Push(IndentType.Block);
 
290
                                        FixStatementIndentation(initializer.StartLocation);
 
291
                                        curIndent.Pop ();
 
292
                                        lastLoc = initializer.StartLocation;
 
293
                                }
 
294
                                initializer.AcceptVisitor(this);
 
295
                        }
 
296
                }
 
297
 
 
298
                public override void VisitFixedFieldDeclaration(FixedFieldDeclaration fixedFieldDeclaration)
 
299
                {
 
300
                        FixAttributes(fixedFieldDeclaration);
 
301
 
 
302
                        FormatCommas(fixedFieldDeclaration, policy.SpaceBeforeFieldDeclarationComma, policy.SpaceAfterFieldDeclarationComma);
 
303
 
 
304
                        var lastLoc = fixedFieldDeclaration.StartLocation;
 
305
                        curIndent.Push(IndentType.Block);
 
306
                        foreach (var initializer in fixedFieldDeclaration.Variables) {
 
307
                                if (lastLoc.Line != initializer.StartLocation.Line) {
 
308
                                        FixStatementIndentation(initializer.StartLocation);
 
309
                                        lastLoc = initializer.StartLocation;
 
310
                                }
 
311
                                initializer.AcceptVisitor(this);
 
312
                        }
 
313
                        curIndent.Pop ();
 
314
                }
 
315
 
 
316
                public override void VisitEnumMemberDeclaration(EnumMemberDeclaration enumMemberDeclaration)
 
317
                {
 
318
                        FixAttributes(enumMemberDeclaration);
 
319
 
 
320
                        base.VisitEnumMemberDeclaration(enumMemberDeclaration);
 
321
                }
 
322
 
 
323
                public override void VisitMethodDeclaration(MethodDeclaration methodDeclaration)
 
324
                {
 
325
                        FixAttributes(methodDeclaration);
 
326
 
 
327
                        ForceSpacesBefore(methodDeclaration.LParToken, policy.SpaceBeforeMethodDeclarationParentheses);
 
328
                        if (methodDeclaration.Parameters.Any()) {
 
329
                                ForceSpacesAfter(methodDeclaration.LParToken, policy.SpaceWithinMethodDeclarationParentheses);
 
330
                                FormatArguments(methodDeclaration);
 
331
                        } else {
 
332
                                ForceSpacesAfter(methodDeclaration.LParToken, policy.SpaceBetweenEmptyMethodDeclarationParentheses);
 
333
                                ForceSpacesBefore(methodDeclaration.RParToken, policy.SpaceBetweenEmptyMethodDeclarationParentheses);
 
334
                        }
 
335
 
 
336
                        if (!methodDeclaration.Body.IsNull) {
 
337
                                FixOpenBrace(policy.MethodBraceStyle, methodDeclaration.Body.LBraceToken);
 
338
                                VisitBlockWithoutFixingBraces(methodDeclaration.Body, policy.IndentMethodBody);
 
339
                                FixClosingBrace(policy.MethodBraceStyle, methodDeclaration.Body.RBraceToken);
 
340
                        }
 
341
                }
 
342
 
 
343
                public override void VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration)
 
344
                {
 
345
                        FixAttributes(operatorDeclaration);
 
346
 
 
347
                        ForceSpacesBefore(operatorDeclaration.LParToken, policy.SpaceBeforeMethodDeclarationParentheses);
 
348
                        if (operatorDeclaration.Parameters.Any()) {
 
349
                                ForceSpacesAfter(operatorDeclaration.LParToken, policy.SpaceWithinMethodDeclarationParentheses);
 
350
                                FormatArguments(operatorDeclaration);
 
351
                        } else {
 
352
                                ForceSpacesAfter(operatorDeclaration.LParToken, policy.SpaceBetweenEmptyMethodDeclarationParentheses);
 
353
                                ForceSpacesBefore(operatorDeclaration.RParToken, policy.SpaceBetweenEmptyMethodDeclarationParentheses);
 
354
                        }
 
355
 
 
356
                        if (!operatorDeclaration.Body.IsNull) {
 
357
                                FixOpenBrace(policy.MethodBraceStyle, operatorDeclaration.Body.LBraceToken);
 
358
                                VisitBlockWithoutFixingBraces(operatorDeclaration.Body, policy.IndentMethodBody);
 
359
                                FixClosingBrace(policy.MethodBraceStyle, operatorDeclaration.Body.RBraceToken);
 
360
                        }
 
361
                }
 
362
 
 
363
                public override void VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration)
 
364
                {
 
365
                        FixAttributes(constructorDeclaration);
 
366
 
 
367
                        ForceSpacesBefore(constructorDeclaration.LParToken, policy.SpaceBeforeConstructorDeclarationParentheses);
 
368
                        if (constructorDeclaration.Parameters.Any()) {
 
369
                                ForceSpacesAfter(constructorDeclaration.LParToken, policy.SpaceWithinConstructorDeclarationParentheses);
 
370
                                FormatArguments(constructorDeclaration);
 
371
                        } else {
 
372
                                ForceSpacesAfter(constructorDeclaration.LParToken, policy.SpaceBetweenEmptyConstructorDeclarationParentheses);
 
373
                                ForceSpacesBefore(constructorDeclaration.RParToken, policy.SpaceBetweenEmptyConstructorDeclarationParentheses);
 
374
                        }
 
375
 
 
376
                        if (!constructorDeclaration.Body.IsNull) {
 
377
                                FixOpenBrace(policy.ConstructorBraceStyle, constructorDeclaration.Body.LBraceToken);
 
378
                                VisitBlockWithoutFixingBraces(constructorDeclaration.Body, policy.IndentMethodBody);
 
379
                                FixClosingBrace(policy.ConstructorBraceStyle, constructorDeclaration.Body.RBraceToken);
 
380
                        }
 
381
                }
 
382
 
 
383
                public override void VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration)
 
384
                {
 
385
                        FixAttributes(destructorDeclaration);
 
386
 
 
387
                        CSharpTokenNode lParen = destructorDeclaration.LParToken;
 
388
                        ForceSpaceBefore(lParen, policy.SpaceBeforeConstructorDeclarationParentheses);
 
389
 
 
390
                        if (!destructorDeclaration.Body.IsNull) {
 
391
                                FixOpenBrace(policy.DestructorBraceStyle, destructorDeclaration.Body.LBraceToken);
 
392
                                VisitBlockWithoutFixingBraces(destructorDeclaration.Body, policy.IndentMethodBody);
 
393
                                FixClosingBrace(policy.DestructorBraceStyle, destructorDeclaration.Body.RBraceToken);
 
394
                        }
 
395
                }
 
396
        }
 
397
}
 
398