Skip to content

Commit b7d3d36

Browse files
ddobrevtritao
authored andcommitted
Renamed members related to indentation for more clarity.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent d243780 commit b7d3d36

File tree

12 files changed

+307
-307
lines changed

12 files changed

+307
-307
lines changed

src/Core/Diagnostics.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ public void Emit(DiagnosticInfo info)
117117
if (info.Kind < Level)
118118
return;
119119

120-
var currentIndent = Indents.Sum();
121-
var message = new string(' ', currentIndent) + info.Message;
120+
var currentIndentation = Indents.Sum();
121+
var message = new string(' ', currentIndentation) + info.Message;
122122

123123
if(info.Kind == DiagnosticKind.Error)
124124
{

src/Generator/Generators/CLI/CLIHeaders.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ public void GenerateNamespace(Namespace @namespace)
194194
WriteLine("namespace {0}", isTopLevel
195195
? @namespace.TranslationUnit.Module.OutputNamespace
196196
: @namespace.Name);
197-
WriteStartBraceIndent();
197+
WriteOpenBraceAndIndent();
198198
}
199199

200200
GenerateDeclContext(@namespace);
201201

202202
if (generateNamespace)
203203
{
204-
WriteCloseBraceIndent();
204+
UnindentAndWriteCloseBrace();
205205
PopBlock(NewLineKind.BeforeNextBlock);
206206
}
207207
}
@@ -224,15 +224,15 @@ public void GenerateFunctions(DeclarationContext decl)
224224
WriteLine("public ref class {0}", TranslationUnit.FileNameWithoutExtension);
225225
WriteLine("{");
226226
WriteLine("public:");
227-
PushIndent();
227+
Indent();
228228

229229
// Generate all the function declarations for the module.
230230
foreach (var function in decl.Functions)
231231
{
232232
GenerateFunction(function);
233233
}
234234

235-
PopIndent();
235+
Unindent();
236236
WriteLine("};");
237237

238238
PopBlock(NewLineKind.BeforeNextBlock);
@@ -259,9 +259,9 @@ public void GenerateClass(Class @class)
259259
NewLine();
260260

261261
// Process the nested types.
262-
PushIndent();
262+
Indent();
263263
GenerateDeclContext(@class);
264-
PopIndent();
264+
Unindent();
265265

266266
var nativeType = string.Format("::{0}*", @class.QualifiedOriginalName);
267267

@@ -308,20 +308,20 @@ public void GenerateClassNativeField(Class @class, string nativeType)
308308
{
309309
WriteLineIndent("property {0} NativePtr;", nativeType);
310310

311-
PushIndent();
311+
Indent();
312312
WriteLine("property System::IntPtr {0}", Helpers.InstanceIdentifier);
313-
WriteStartBraceIndent();
313+
WriteOpenBraceAndIndent();
314314
WriteLine("virtual System::IntPtr get();");
315315
WriteLine("virtual void set(System::IntPtr instance);");
316-
WriteCloseBraceIndent();
316+
UnindentAndWriteCloseBrace();
317317
NewLine();
318318

319-
PopIndent();
319+
Unindent();
320320
}
321321

322322
public void GenerateClassGenericMethods(Class @class)
323323
{
324-
PushIndent();
324+
Indent();
325325
foreach (var template in @class.Templates)
326326
{
327327
if (!template.IsGenerated) continue;
@@ -368,15 +368,15 @@ public void GenerateClassGenericMethods(Class @class)
368368

369369
PopBlock(NewLineKind.BeforeNextBlock);
370370
}
371-
PopIndent();
371+
Unindent();
372372
}
373373

374374
public void GenerateClassConstructors(Class @class, string nativeType)
375375
{
376376
if (@class.IsStatic)
377377
return;
378378

379-
PushIndent();
379+
Indent();
380380

381381
// Output a default constructor that takes the native pointer.
382382
WriteLine("{0}({1} native);", @class.Name, nativeType);
@@ -407,7 +407,7 @@ public void GenerateClassConstructors(Class @class, string nativeType)
407407
}
408408
}
409409

410-
PopIndent();
410+
Unindent();
411411
}
412412

413413
private void GenerateClassDestructor(Class @class)
@@ -436,7 +436,7 @@ public void GenerateClassFields(Class @class)
436436
}
437437
}
438438

439-
PushIndent();
439+
Indent();
440440
// check for value types because some of the ignored fields may back properties;
441441
// not the case for ref types because the NativePtr pattern is used there
442442
foreach (var field in @class.Fields.Where(f => !ASTUtils.CheckIgnoreField(f)))
@@ -447,7 +447,7 @@ public void GenerateClassFields(Class @class)
447447
GenerateField(@class, field);
448448
}
449449
}
450-
PopIndent();
450+
Unindent();
451451
}
452452

453453
private void GenerateField(Class @class, Field field)
@@ -473,7 +473,7 @@ public void GenerateClassEvents(Class @class)
473473
var cppArgs = cppTypePrinter.VisitParameters(@event.Parameters, hasNames: true);
474474

475475
WriteLine("private:");
476-
PushIndent();
476+
Indent();
477477

478478
var delegateName = string.Format("_{0}Delegate", @event.Name);
479479
WriteLine("delegate void {0}({1});", delegateName, cppArgs);
@@ -482,12 +482,12 @@ public void GenerateClassEvents(Class @class)
482482
WriteLine("void _{0}Raise({1});", @event.Name, cppArgs);
483483
WriteLine("{0} _{1};", @event.Type, @event.Name);
484484

485-
PopIndent();
485+
Unindent();
486486
WriteLine("public:");
487-
PushIndent();
487+
Indent();
488488

489489
WriteLine("event {0} {1}", @event.Type, @event.Name);
490-
WriteStartBraceIndent();
490+
WriteOpenBraceAndIndent();
491491

492492
WriteLine("void add({0} evt);", @event.Type);
493493
WriteLine("void remove({0} evt);", @event.Type);
@@ -496,8 +496,8 @@ public void GenerateClassEvents(Class @class)
496496
var cliArgs = cliTypePrinter.VisitParameters(@event.Parameters, hasNames: true);
497497

498498
WriteLine("void raise({0});", cliArgs);
499-
WriteCloseBraceIndent();
500-
PopIndent();
499+
UnindentAndWriteCloseBrace();
500+
Unindent();
501501
}
502502
}
503503

@@ -506,7 +506,7 @@ public void GenerateClassMethods(List<Method> methods)
506506
if (methods.Count == 0)
507507
return;
508508

509-
PushIndent();
509+
Indent();
510510

511511
var @class = (Class) methods[0].Namespace;
512512

@@ -535,12 +535,12 @@ public void GenerateClassMethods(List<Method> methods)
535535
foreach(var method in staticMethods)
536536
GenerateMethod(method);
537537

538-
PopIndent();
538+
Unindent();
539539
}
540540

541541
public void GenerateClassVariables(Class @class)
542542
{
543-
PushIndent();
543+
Indent();
544544

545545
foreach(var variable in @class.Variables)
546546
{
@@ -555,7 +555,7 @@ public void GenerateClassVariables(Class @class)
555555

556556
WriteLine("static property {0} {1}", type, variable.Name);
557557

558-
WriteStartBraceIndent();
558+
WriteOpenBraceAndIndent();
559559

560560
WriteLine("{0} get();", type);
561561

@@ -564,12 +564,12 @@ public void GenerateClassVariables(Class @class)
564564
if (!qualifiedType.Qualifiers.IsConst)
565565
WriteLine("void set({0});", type);
566566

567-
WriteCloseBraceIndent();
567+
UnindentAndWriteCloseBrace();
568568

569569
PopBlock(NewLineKind.BeforeNextBlock);
570570
}
571571

572-
PopIndent();
572+
Unindent();
573573
}
574574

575575
public override void GenerateClassSpecifier(Class @class)
@@ -612,7 +612,7 @@ public void GenerateClassProperties(Class @class)
612612
}
613613
}
614614

615-
PushIndent();
615+
Indent();
616616
foreach (var prop in @class.Properties.Where(
617617
prop => !ASTUtils.CheckIgnoreProperty(prop) && !TypeIgnored(prop.Type)))
618618
{
@@ -625,7 +625,7 @@ public void GenerateClassProperties(Class @class)
625625
GenerateDeclarationCommon(prop);
626626
GenerateProperty(prop);
627627
}
628-
PopIndent();
628+
Unindent();
629629
}
630630

631631
public void GenerateIndexer(Property property)
@@ -636,15 +636,15 @@ public void GenerateIndexer(Property property)
636636
var indexParameterType = indexParameter.QualifiedType.Visit(TypePrinter);
637637

638638
WriteLine("property {0} default[{1}]", type, indexParameterType);
639-
WriteStartBraceIndent();
639+
WriteOpenBraceAndIndent();
640640

641641
if (property.HasGetter)
642642
WriteLine("{0} get({1} {2});", type, indexParameterType, indexParameter.Name);
643643

644644
if (property.HasSetter)
645645
WriteLine("void set({1} {2}, {0} value);", type, indexParameterType, indexParameter.Name);
646646

647-
WriteCloseBraceIndent();
647+
UnindentAndWriteCloseBrace();
648648
}
649649

650650
public void GenerateProperty(Property property)
@@ -665,15 +665,15 @@ public void GenerateProperty(Property property)
665665
else
666666
{
667667
WriteLine("property {0} {1}", type, property.Name);
668-
WriteStartBraceIndent();
668+
WriteOpenBraceAndIndent();
669669

670670
if (property.HasGetter)
671671
WriteLine("{0} get();", type);
672672

673673
if (property.HasSetter)
674674
WriteLine("void set({0});", type);
675675

676-
WriteCloseBraceIndent();
676+
UnindentAndWriteCloseBrace();
677677
}
678678

679679
PopBlock(NewLineKind.BeforeNextBlock);
@@ -835,11 +835,11 @@ public void GenerateEnum(Enumeration @enum)
835835
Write(" : {0}", typeName);
836836

837837
NewLine();
838-
WriteStartBraceIndent();
838+
WriteOpenBraceAndIndent();
839839

840840
GenerateEnumItems(@enum);
841841

842-
PopIndent();
842+
Unindent();
843843
WriteLine("};");
844844

845845
PopBlock(NewLineKind.BeforeNextBlock);

src/Generator/Generators/CLI/CLIMarshal.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ public override bool VisitArrayType(ArrayType array, TypeQualifiers quals)
4747
string value = Generator.GeneratedIdentifier("array") + Context.ParameterIndex;
4848
Context.Before.WriteLine("cli::array<{0}>^ {1} = nullptr;", array.Type, value, array.Size);
4949
Context.Before.WriteLine("if ({0} != 0)", Context.ReturnVarName);
50-
Context.Before.WriteStartBraceIndent();
50+
Context.Before.WriteOpenBraceAndIndent();
5151
Context.Before.WriteLine("{0} = gcnew cli::array<{1}>({2});", value, array.Type, array.Size);
5252
Context.Before.WriteLine("for (int i = 0; i < {0}; i++)", array.Size);
5353
if (array.Type.IsPointerToPrimitiveType(PrimitiveType.Void))
5454
Context.Before.WriteLineIndent("{0}[i] = new ::System::IntPtr({1}[i]);",
5555
value, Context.ReturnVarName);
5656
else
5757
Context.Before.WriteLineIndent("{0}[i] = {1}[i];", value, Context.ReturnVarName);
58-
Context.Before.WriteCloseBraceIndent();
58+
Context.Before.UnindentAndWriteCloseBrace();
5959
Context.Return.Write(value);
6060
break;
6161
case ArrayType.ArraySize.Incomplete:
@@ -468,12 +468,12 @@ public override bool VisitArrayType(ArrayType array, TypeQualifiers quals)
468468
{
469469
var supportBefore = Context.Before;
470470
supportBefore.WriteLine("if ({0} != nullptr)", Context.ArgName);
471-
supportBefore.WriteStartBraceIndent();
471+
supportBefore.WriteOpenBraceAndIndent();
472472
supportBefore.WriteLine("for (int i = 0; i < {0}; i++)", array.Size);
473473
supportBefore.WriteLineIndent("{0}[i] = {1}[i]{2};",
474474
Context.ReturnVarName, Context.ArgName,
475475
array.Type.IsPointerToPrimitiveType(PrimitiveType.Void) ? ".ToPointer()" : string.Empty);
476-
supportBefore.WriteCloseBraceIndent();
476+
supportBefore.UnindentAndWriteCloseBrace();
477477
}
478478
break;
479479
default:
@@ -775,7 +775,7 @@ private void MarshalValueClassProperty(Property property, string marshalVar)
775775
var fieldRef = string.Format("{0}.{1}", Context.Parameter.Name,
776776
property.Name);
777777

778-
var marshalCtx = new MarshalContext(Context.Context, Context.Indent)
778+
var marshalCtx = new MarshalContext(Context.Context, Context.Indentation)
779779
{
780780
ArgName = fieldRef,
781781
ParameterIndex = Context.ParameterIndex++,
@@ -799,14 +799,14 @@ private void MarshalValueClassProperty(Property property, string marshalVar)
799799
if (isRef)
800800
{
801801
Context.Before.WriteLine("if ({0} != nullptr)", fieldRef);
802-
Context.Before.PushIndent();
802+
Context.Before.Indent();
803803
}
804804

805805
Context.Before.WriteLine("{0}.{1} = {2};", marshalVar,
806806
property.Field.OriginalName, marshal.Context.Return);
807807

808808
if (isRef)
809-
Context.Before.PopIndent();
809+
Context.Before.Unindent();
810810
}
811811

812812
public override bool VisitFieldDecl(Field field)

0 commit comments

Comments
 (0)