Browse Source

Fixed a bug causing the header file to be included twice when Options.GenerateName is not null (#1803)

pull/1811/head
zylalx1 3 years ago committed by GitHub
parent
commit
12c267d9c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/Generator/Generators/C/CppHeaders.cs
  2. 3
      src/Generator/Generators/C/CppSources.cs
  3. 4
      src/Generator/Generators/CLI/CLIHeaders.cs
  4. 4
      src/Generator/Generators/CLI/CLISources.cs

4
src/Generator/Generators/C/CppHeaders.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using CppSharp.AST; using CppSharp.AST;
using CppSharp.AST.Extensions; using CppSharp.AST.Extensions;
@ -87,7 +88,8 @@ namespace CppSharp.Generators.Cpp
if (typeRef.Include.TranslationUnit == unit) if (typeRef.Include.TranslationUnit == unit)
continue; continue;
if (typeRef.Include.File == unit.FileName) var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName;
if (typeRef.Include.File == filename)
continue; continue;
var include = typeRef.Include; var include = typeRef.Include;

3
src/Generator/Generators/C/CppSources.cs

@ -64,7 +64,8 @@ namespace CppSharp.Generators.Cpp
foreach (var typeRef in typeReferenceCollector.TypeReferences) foreach (var typeRef in typeReferenceCollector.TypeReferences)
{ {
if (typeRef.Include.File == unit.FileName) var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName;
if (typeRef.Include.File == filename)
continue; continue;
var include = typeRef.Include; var include = typeRef.Include;

4
src/Generator/Generators/CLI/CLIHeaders.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using CppSharp.AST; using CppSharp.AST;
using CppSharp.AST.Extensions; using CppSharp.AST.Extensions;
@ -61,7 +62,8 @@ namespace CppSharp.Generators.CLI
if (typeRef.Include.TranslationUnit == TranslationUnit) if (typeRef.Include.TranslationUnit == TranslationUnit)
continue; continue;
if (typeRef.Include.File == TranslationUnit.FileName) var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName;
if (typeRef.Include.File == filename)
continue; continue;
var include = typeRef.Include; var include = typeRef.Include;

4
src/Generator/Generators/CLI/CLISources.cs

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using CppSharp.AST; using CppSharp.AST;
using CppSharp.AST.Extensions; using CppSharp.AST.Extensions;
@ -61,7 +62,8 @@ namespace CppSharp.Generators.CLI
foreach (var typeRef in typeReferenceCollector.TypeReferences) foreach (var typeRef in typeReferenceCollector.TypeReferences)
{ {
if (typeRef.Include.File == TranslationUnit.FileName) var filename = Context.Options.GenerateName != null ? $"{Context.Options.GenerateName(TranslationUnit)}{Path.GetExtension(TranslationUnit.FileName)}" : TranslationUnit.FileName;
if (typeRef.Include.File == filename)
continue; continue;
var include = typeRef.Include; var include = typeRef.Include;

Loading…
Cancel
Save