Skip to content

Commit 277dc5c

Browse files
committed
Misc changes
1 parent c09b1a5 commit 277dc5c

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

CppSharp.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
22
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CLI/@EntryIndexedValue">CLI</s:String>
3+
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD</s:String>
34
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MSVC/@EntryIndexedValue">MSVC</s:String>
45
<s:Boolean x:Key="/Default/UserDictionary/Words/=diag/@EntryIndexedValue">True</s:Boolean>
56
<s:Boolean x:Key="/Default/UserDictionary/Words/=undefine/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/CppParser/Bootstrap/CodeGeneratorHelpers.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public static bool SkipProperty(Property property, bool skipBaseCheck = false)
4747
return true;
4848
}
4949

50-
if (property.Name is "beginLoc" or "endLoc" &&
51-
@class.Name != "Stmt")
50+
if (property.Name is "beginLoc" or "endLoc" && @class.Name != "Stmt")
5251
return true;
5352

5453
switch (property.Name)
@@ -309,7 +308,7 @@ public static string GetQualifiedName(Declaration decl,
309308
else if (qualifiedName.Contains("Semantics"))
310309
qualifiedName = qualifiedName.Replace(
311310
typePrinter is CppTypePrinter ? "llvm::APFloatBase::Semantics" : "llvm.APFloatBase.Semantics"
312-
, "FloatSemantics");
311+
, "FloatSemantics");
313312

314313
return qualifiedName;
315314
}
@@ -319,11 +318,13 @@ public static string GetQualifiedName(Declaration decl) =>
319318

320319
private static string CleanClangNamespaceFromName(string qualifiedName)
321320
{
322-
qualifiedName = qualifiedName.StartsWith("clang::") ?
323-
qualifiedName.Substring("clang::".Length) : qualifiedName;
321+
qualifiedName = qualifiedName.StartsWith("clang::")
322+
? qualifiedName.Substring("clang::".Length)
323+
: qualifiedName;
324324

325-
qualifiedName = qualifiedName.StartsWith("clang.") ?
326-
qualifiedName.Substring("clang.".Length) : qualifiedName;
325+
qualifiedName = qualifiedName.StartsWith("clang.")
326+
? qualifiedName.Substring("clang.".Length)
327+
: qualifiedName;
327328

328329
return qualifiedName;
329330
}
@@ -392,7 +393,8 @@ public static string GetDeclTypeName(AST.Type type,
392393

393394
if (typeResult.Type.Contains("MSGuidDecl"))
394395
return typePrinter is CppTypePrinter
395-
? "std::string" : "string";
396+
? "std::string"
397+
: "string";
396398

397399
var typeName = typeResult.ToString();
398400
typeName = CleanClangNamespaceFromName(typeName);
@@ -436,8 +438,7 @@ public static string GetDeclTypeName(AST.Type type,
436438
className = "Declaration";
437439

438440
if (className != null)
439-
return (typePrinter is CppTypePrinter) ?
440-
$"{className}*" : className;
441+
return (typePrinter is CppTypePrinter) ? $"{className}*" : className;
441442

442443
return typeName;
443444
}
@@ -525,8 +526,7 @@ public static List<Class> GetBaseClasses(Class @class)
525526
while (currentClass != null)
526527
{
527528
baseClasses.Add(currentClass);
528-
currentClass = currentClass.HasBaseClass ?
529-
currentClass.BaseClass : null;
529+
currentClass = currentClass.HasBaseClass ? currentClass.BaseClass : null;
530530
}
531531

532532
baseClasses.Reverse();

src/Generator/Generators/CSharp/CSharpTypePrinter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ public override TypePrinterResult VisitTemplateSpecializationType(
315315
TemplateArgument lastArg = args.Last();
316316
TypePrinterResult typePrinterResult = VisitDeclaration(decl);
317317
typePrinterResult.NameSuffix.Append($@"<{string.Join(", ",
318-
args.Concat(Enumerable.Range(0, @class.TemplateParameters.Count - args.Count).Select(
318+
args.Concat(Enumerable.Range(0, @class.TemplateParameters?.Count ?? 0 - args.Count).Select(
319319
i => lastArg)).Select(this.VisitTemplateArgument))}>");
320320
return typePrinterResult;
321321
}

0 commit comments

Comments
 (0)